quantize

open fun quantize(inputPixels: Array<Int>, startingClusters: Array<Int>, maxColors: Int): Map<Integer, Integer>

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, values of how many of the input pixels belong to the color.

Parameters

inputPixels

Colors in ARGB format.

startingClusters

Defines the initial state of the quantizer. Passing an empty array is fine, the implementation will create its own initial state that leads to reproducible results for the same inputs. Passing an array that is the result of Wu quantization leads to higher quality results.

maxColors

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