quantize

fun quantize(pixels: IntArray, maxColors: Int): Map<Int, Int>

Reduce the number of colors needed to represented the input, minimizing the difference between the original image and the recolored image.

Return

Map with keys of colors in ARGB format, and values of number of pixels in the original image that correspond to the color in the quantized image.

Parameters

pixels

Colors in ARGB format.

maxColors

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