@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

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

Properties

Property Modifiers Type Description
data Uint32Array
getHistogramIndex (r: number, g: number, b: number) => number
getHistogramValue (r: number, g: number, b: number) => number
maxBlue number
maxGreen number
maxRed number
minBlue number
minGreen number
minRed number
setHistogramValue (value: number, r: number, g: number, b: number) => void
significantBits number
total number