Name

Quantize( ) — set the maximum number of colors in an image

Synopsis

$image->Quantize(colors=>integer,
                    colorspace=>{RGB, Gray, Transparent, OHTA, XYZ, YCbCr,
                    YCC, YIQ, YPbPr, YUV, CMYK},
                    treedepth=>integer,
                    dither=>{1, 0})

The Quantize( ) method sets the maximum number of colors in an image. If the specified number of colors is less than the number of colors in the image, the size of the colormap is intelligently reduced to the new number. Setting the dither attribute will cause the image to be dithered to more accurately represent colors. See the descriptions of the colors, colorspace, and dither attributes in the earlier section Section 5.5.

Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.