# ImageMagick QuantizeInfo Structure

The QuantizeInfo structure is used to support passing parameters to ImageMagick's color quantization (reduction) functions. Color quantization is the process of analyzing one or more images, and calculating a color palette which best approximates the image within a specified colorspace, and then adjusting the image pixels to use the calculated color palette. The maximum number of colors allowed in the color palette may be specified.

Methods Supporting QuantizeInfo
Method | Description
GetQuantizeInfo() | Allocate new structure with defaults set.
CloneQuantizeInfo() | Copy existing structure, allocating new structure in the process.
DestroyQuantizeInfo() | Deallocate structure, including any members.
QuantizeImage | Analyzes the colors within a reference image and chooses a fixed number of colors to represent the image.
QuantizeImages | Analyzes the colors within a set of reference images and chooses a fixed number of colors to represent the set.

QuantizeInfo Structure Members
Member | Type | Description
colorspace | ColorspaceType | The colorspace to quantize in. Color reduction, by default, takes place in the RGB color space. Empirical evidence suggests that distances in color spaces such as YUV or YIQ correspond to perceptual color differences more closely than do distances in RGB space. The Transparent color space behaves uniquely in that it preserves the matte channel of the image if it exists.
dither | unsigned int | Set to True (non-zero) to apply Floyd/Steinberg error diffusion to the image. When the size of the color palette is less than the image colors, this trades off spacial resolution for color resolution by dithering to achieve a similar looking image.
measure_error | unsigned int | Set to True (non-zero) to calculate quantization errors when quantizing the image.
number_colors | unsigned int | Specify the maximum number of colors in the output image. Must be equal to, or less than MaxRGB, which is determined by the value of QuantumLeap when ImageMagick was compiled.
signature | unsigned long | ???
tree_depth | unsigned int | Specify the tree depth to use while quantizing. The values zero and one support automatic tree depth determination. The tree depth may be forced via values ranging from two to eight. The ideal tree depth depends on the characteristics of the input image, and may be determined through experimentation.

Image manipulation software that works like magic.