NeuralQuantizer class
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
- BG_COLOR ↔ int
-
read / write
- colorMap ↔ Uint8List
-
read / write
- CUT_NET_SIZE ↔ int
-
read / write
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- INIT_BIAS_RADIUS ↔ int
-
read / write
- INIT_RAD ↔ int
-
read / write
- MAX_NET_POS ↔ int
-
read / write
- NET_SIZE ↔ 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 -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited
Constants
- ALPHA_BIAS_SHIFT → const int
-
10
- BETA → const double
-
1.0 / 1024.0
- BETA_GAMMA → const double
-
BETA * GAMMA
- GAMMA → const double
-
1024.0
- INIT_ALPHA → const int
-
1 << ALPHA_BIAS_SHIFT
- MAX_PRIME → const int
-
PRIME4
- NUM_CYCLES → const int
-
100
- PRIME1 → const int
-
499
- PRIME2 → const int
-
491
- PRIME3 → const int
-
487
- PRIME4 → const int
-
503
- RADIUS_BIAS → const int
-
1 << RADIUS_BIAS_SHIFT
- RADIUS_BIAS_SHIFT → const int
-
6
- RADIUS_DEC → const int
-
30