WuQuant | Image Quantization Library (image-q)

### Hierarchy

- WuQuant

## Index

### Constructors

- constructor

### Properties

- _alphaMaxSideIndex
- _alphaSideSize
- _alphas
- _blues
- _colors
- _cubes
- _distance
- _greens
- _maxSideIndex
- _moments
- _momentsAlpha
- _momentsBlue
- _momentsGreen
- _momentsRed
- _pixels
- _reds
- _sideSize
- _significantBitsPerChannel
- _sums
- _table
- _weights
- alpha
- blue
- green
- red

### Methods

- _addColor
- _calculateMoments
- _calculateVariance
- _cut
- _initialize
- _maximize
- _preparePalette
- _setQuality
- quantize
- sample
- _bottom
- _top
- _volume
- _volumeFloat

## Constructors

### constructor

- new WuQuant(colorDistanceCalculator: IDistanceCalculator, colors?: number, significantBitsPerChannel?: number): WuQuant

- - Defined in palette/wu/wuQuant.ts:112

  #### Parameters

  - ##### colorDistanceCalculator: IDistanceCalculator

  - ##### Default value colors: number = 256

  - ##### Default value significantBitsPerChannel: number = 5

  #### Returns WuQuant

## Properties

### Private _alphaMaxSideIndex

_alphaMaxSideIndex: number

- Defined in palette/wu/wuQuant.ts:108

### Private _alphaSideSize

_alphaSideSize: number

- Defined in palette/wu/wuQuant.ts:110

### Private _alphas

_alphas: number[]

- Defined in palette/wu/wuQuant.ts:90

### Private _blues

_blues: number[]

- Defined in palette/wu/wuQuant.ts:89

### Private _colors

_colors: number

- Defined in palette/wu/wuQuant.ts:104

### Private _cubes

_cubes: WuColorCube[]

- Defined in palette/wu/wuQuant.ts:103

### Private _distance

_distance: IDistanceCalculator

- Defined in palette/wu/wuQuant.ts:112

### Private _greens

_greens: number[]

- Defined in palette/wu/wuQuant.ts:88

### Private _maxSideIndex

_maxSideIndex: number

- Defined in palette/wu/wuQuant.ts:107

### Private _moments

_moments: number[]

- Defined in palette/wu/wuQuant.ts:98

### Private _momentsAlpha

_momentsAlpha: number[]

- Defined in palette/wu/wuQuant.ts:97

### Private _momentsBlue

_momentsBlue: number[]

- Defined in palette/wu/wuQuant.ts:96

### Private _momentsGreen

_momentsGreen: number[]

- Defined in palette/wu/wuQuant.ts:95

### Private _momentsRed

_momentsRed: number[]

- Defined in palette/wu/wuQuant.ts:94

### Private _pixels

_pixels: Point[]

- Defined in palette/wu/wuQuant.ts:101

### Private _reds

_reds: number[]

- Defined in palette/wu/wuQuant.ts:87

### Private _sideSize

_sideSize: number

- Defined in palette/wu/wuQuant.ts:109

### Private _significantBitsPerChannel

_significantBitsPerChannel: number

- Defined in palette/wu/wuQuant.ts:106

### Private _sums

_sums: number[]

- Defined in palette/wu/wuQuant.ts:91

### Private _table

_table: number[]

- Defined in palette/wu/wuQuant.ts:100

### Private _weights

_weights: number[]

- Defined in palette/wu/wuQuant.ts:93

### Static Private alpha

alpha: number

- Defined in palette/wu/wuQuant.ts:82

### Static Private blue

blue: number

- Defined in palette/wu/wuQuant.ts:85

### Static Private green

green: number

- Defined in palette/wu/wuQuant.ts:84

### Static Private red

red: number

- Defined in palette/wu/wuQuant.ts:83

## Methods

### Private _addColor

- _addColor(color: Point): void

- - Defined in palette/wu/wuQuant.ts:255

  #### Parameters

  - ##### color: Point

  #### Returns void

### Private _calculateMoments

- _calculateMoments(): void

- - Defined in palette/wu/wuQuant.ts:275

  Converts the histogram to a series of _moments.

  #### Returns void

### Private _calculateVariance

- _calculateVariance(cube: WuColorCube): number

- - Defined in palette/wu/wuQuant.ts:485

  Calculates statistical variance for a given cube.

  #### Parameters

  - ##### cube: WuColorCube

  #### Returns number

### Private _cut

- _cut(first: WuColorCube, second: WuColorCube): boolean

- - Defined in palette/wu/wuQuant.ts:546

  #### Parameters

  - ##### first: WuColorCube

  - ##### second: WuColorCube

  #### Returns boolean

### Private _initialize

- _initialize(colors: number): void

- - Defined in palette/wu/wuQuant.ts:619

  #### Parameters

  - ##### colors: number

  #### Returns void

### Private _maximize

- _maximize(cube: WuColorCube, direction: number, first: number, last: number, wholeRed: number, wholeGreen: number, wholeBlue: number, wholeAlpha: number, wholeWeight: number): object

- - Defined in palette/wu/wuQuant.ts:501

  Finds the optimal (maximal) position for the cut.

  #### Parameters

  - ##### cube: WuColorCube

  - ##### direction: number

  - ##### first: number

  - ##### last: number

  - ##### wholeRed: number

  - ##### wholeGreen: number

  - ##### wholeBlue: number

  - ##### wholeAlpha: number

  - ##### wholeWeight: number

  #### Returns object

  - ##### max: number

  - ##### position: number

### Private _preparePalette

- _preparePalette(): void

- - Defined in palette/wu/wuQuant.ts:153

  #### Returns void

### Private _setQuality

- _setQuality(significantBitsPerChannel?: number): void

- - Defined in palette/wu/wuQuant.ts:657

  #### Parameters

  - ##### Default value significantBitsPerChannel: number = 5

  #### Returns void

### quantize

- quantize(): Palette

- - Defined in palette/wu/wuQuant.ts:130

  #### Returns Palette

### sample

- sample(image: PointContainer): void

- - Defined in palette/wu/wuQuant.ts:120

  #### Parameters

  - ##### image: PointContainer

  #### Returns void

### Static Private _bottom

- _bottom(cube: WuColorCube, direction: number, moment: number[]): number

- - Defined in palette/wu/wuQuant.ts:435

  Splits the cube in a given color direction at its minimum.

  #### Parameters

  - ##### cube: WuColorCube

  - ##### direction: number

  - ##### moment: number[]

  #### Returns number

### Static Private _top

- _top(cube: WuColorCube, direction: number, position: number, moment: number[]): number

- - Defined in palette/wu/wuQuant.ts:381

  Splits the cube in given position][and color direction.

  #### Parameters

  - ##### cube: WuColorCube

  - ##### direction: number

  - ##### position: number

  - ##### moment: number[]

  #### Returns number

### Static Private _volume

- _volume(cube: WuColorCube, moment: number[]): number

- - Defined in palette/wu/wuQuant.ts:374

  Computes the volume of the cube in a specific moment.

  #### Parameters

  - ##### cube: WuColorCube

  - ##### moment: number[]

  #### Returns number

### Static Private _volumeFloat

- _volumeFloat(cube: WuColorCube, moment: number[]): number

- - Defined in palette/wu/wuQuant.ts:351

  Computes the volume of the cube in a specific moment.

  #### Parameters

  - ##### cube: WuColorCube

  - ##### moment: number[]

  #### Returns number

Generated using TypeDoc