Skip to main content
Version: 1.x

@microsoft/fast-colors > QuantizeConfig

QuantizeConfig interface

A quantize configuration object.

Signature:
export interface QuantizeConfig 

Properties

PropertyTypeDescription
fractionByPopulationnumberFor 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) | nullThis 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) | nullThis 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.
maxIterationsnumberIf 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.
pixelSkippingnumberLowering this value increases the CPU load but includes more pixels in the calculation.
significantBitsnumberMust be in the range [1,8]. Memory use increases as 4*2^(3*significantBits). Setting significantBits to 8 requires a 64 megabyte histogram.
targetPaletteSizenumberDesired output palette size. Actual output may vary in edge cases such as images with very few colors.