quantize

fun QuantizerCelebi.quantize(image: ImageBitmap, maxColors: Int, sampleArea: Int = DEFAULT_SAMPLE_AREA): Map<Int, Int>

Deprecated

Moved to com.materialkolor:material-kolor-palette. Generate a kmpalette Palette from the bitmap and score its swatches with Palette.themeColors. Removed in 7.0.

Quantize the colors in a ImageBitmap to a maximum of maxColors colors.

The image is sampled down to sampleArea pixels first. See samplePixels if you want the sampled pixels yourself.

Return

A map of colors to their frequency in the image.

Parameters

image

the ImageBitmap to extract colors from.

maxColors

The number of colors to divide the image into. A lower number of colors may be returned.

sampleArea

The most pixels to read from the image, or zero and below to read them all.