@microsoft/fast-colors > QuantizeConfig
QuantizeConfig interface
A quantize configuration object.
Signature:export interface QuantizeConfig
Properties
Property | Type | Description |
---|---|---|
fractionByPopulation | number | For a final palette of size targetPaletteSize, we determine the first fractionByPopulation*targetPaletteSize using population as the only factor when determening sort order. For the rest of the colors the sort order is population*colorVolume. This helps highly contrasting colors in a small area to show up in some of the final output. |
isBoxValid | ((box: PixelBox) => boolean) | null | This predicate can be used to screen out undesirable colors from the final output. EG: excluding colors with a pixelCount below a min value. |
isHistogramPixelValid | ((pixel: number[]) => boolean) | null | This predicate can be used to exlude pixels from the histogram. It is passed numbers in the range [0,255] in rgba order. EG: Excluding colors too close to pure white or ones which are transparent. |
maxIterations | number | If the quantization process goes on for more iterations than maxIterations it is aborted and the current results are returned. Only likely to happen in extreme edge cases with strange input. |
pixelSkipping | number | Lowering this value increases the CPU load but includes more pixels in the calculation. |
significantBits | number | Must be in the range [1,8]. Memory use increases as 4*2^(3*significantBits). Setting significantBits to 8 requires a 64 megabyte histogram. |
targetPaletteSize | number | Desired output palette size. Actual output may vary in edge cases such as images with very few colors. |