MagickWand For PHP



MagickQuantizeImages -- analyzes the colors within the MagickWand's sequence of images and chooses a fixed number of colors to represent the images


bool MagickQuantizeImages( MagickWand mgck_wnd, float number_colors, int colorspace_type, float treedepth, bool dither, bool measure_error )

Analyzes the colors within the MagickWand's sequence of images and chooses a fixed number of colors to represent the images. The goal of the algorithm is to minimize the color difference between the original images and the output images while minimizing the processing time. Returns TRUE on success, FALSE, if an error occurred. colorspace_type must be a ColorspaceType constant, one of the following: MW_RGBColorspace MW_GRAYColorspace MW_TransparentColorspace MW_OHTAColorspace MW_LABColorspace MW_XYZColorspace MW_YCbCrColorspace MW_YCCColorspace MW_YIQColorspace MW_YPbPrColorspace MW_YUVColorspace MW_CMYKColorspace MW_sRGBColorspace MW_HSBColorspace MW_HSLColorspace MW_HWBColorspace

A description of each parameter follows:

mgck_wnd A MagickWand resource
number_colors The number of colors.
colorspace Perform color reduction in this colorspace, typically MW_RGBColorspace.
treedepth Normally, this integer value is zero or one.
A zero or one tells Quantize to choose a optimal tree depth of Log4(number_colors).
A tree of this depth generally allows the best representation of the reference image with the least amount of memory and the fastest computational speed.
In some cases, such as an image with low color dispersion (a small number of colors), a value other than Log4(number_colors) is required.
To expand the color tree completely, use a value of 8.
dither If TRUE, distributes the difference between an original image and the corresponding color reduced algorithm to neighboring pixels along a Hilbert curve.
measure_error If TRUE, measures the difference between the original and quantized images.
This difference is the total quantization error.
The error is computed by summing over all pixels in an image the distance squared in RGB space between each reference pixel value and its quantized value

Up Next