NeuralQuantizer class Null safety

Compute a color map with a given number of colors that best represents the given image.

Constructors

NeuralQuantizer(Image image, {int numberOfColors = 256, int samplingFactor = 10})
10 is a reasonable samplingFactor according to https://scientificgems.wordpress.com/stuff/neuquant-fast-high-quality-image-quantization/.

Properties

bgColor int
read / write
colorMap Uint8List
read / write
cutNetSize int
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
initBiasRadius int
read / write
initRadius int
read / write
maxNetPos int?
read / write
netSize int
read / write
numColors int
How many colors are in the colorMap?
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
samplingFactor int
read / write
specials int
read / write

Methods

addImage(Image image) → void
Add an image to the quantized color table.
color(int index) int
Get a color from the colorMap.
getIndexMap(Image image) Uint8List
Convert the image to an index map, mapping to this colorMap.
getQuantizedColor(int c) int
Find the color closest to c in the colorMap.
lookup(int c) int
Find the index of the closest color to c in the colorMap.
lookupRGB(int r, int g, int b) int
Find the index of the closest color to r,g,b in the colorMap.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Constants

alphaBiasShift → const int
10
alphaRadiusBias → const int
(1 << alphaRadiusBiasShift)
alphaRadiusBiasShift → const int
alphaBiasShift + radiusBiasShift
beta → const double
1.0 / 1024.0
betaGamma → const double
beta * gamma
gamma → const double
1024.0
initAlpha → const int
1 << alphaBiasShift
maxPrime → const int
prime4
numCycles → const int
100
prime1 → const int
499
prime2 → const int
491
prime3 → const int
487
prime4 → const int
503
radiusBias → const int
1 << radiusBiasShift
radiusBiasShift → const int
8
radiusDec → const int
30
smallImageBytes → const int
3 * prime4