@microsoft/fast-colors > Histogram

Histogram class

For each possible color, this counts how many pixels in the source image match that color. If signifigantBits is less than 8, each channel (eg: red, green, blue) in each color is reduced to fit in significantBits. So for the default value of 5 significantBits colors are reduced from 8 bits per channel (0-255) to 5 (0-31). Colors that were previously distinct get combined together. If the image source has more than 2^32 pixels (eg: a square image 65536x65536 in size) of the same color this code will break.

Signature:
export declare class Histogram

Constructors

ConstructorModifiersDescription
(constructor)(source, significantBits, pixelSkipping, isHistogramPixelValid)Constructs a new instance of the Histogram class

Properties

PropertyModifiersTypeDescription
dataUint32Array
getHistogramIndex(r: number, g: number, b: number) => number
getHistogramValue(r: number, g: number, b: number) => number
maxBluenumber
maxGreennumber
maxRednumber
minBluenumber
minGreennumber
minRednumber
setHistogramValue(value: number, r: number, g: number, b: number) => void
significantBitsnumber
totalnumber