DJ Mike's Tutorials: PHP

Imagick Functions

^

Imagick::quantizeImage

Description:
bool Imagick::quantizeImage ( int $numberColors , int $colorspace , int $treedepth , bool $dither , bool $measureError )

According to PHP.net Imagick::quantizeImage, Analyzes the colors within a reference image. What it does in practice is reduce the number of colors in an image.
Parameters:
numberColors
Number of colors in the resulting image.
colorspace
Colorspace constants
imagick::COLORSPACE_UNDEFINED
imagick::COLORSPACE_RGB
imagick::COLORSPACE_GRAY
imagick::COLORSPACE_TRANSPARENT
imagick::COLORSPACE_OHTA
imagick::COLORSPACE_LAB
imagick::COLORSPACE_XYZ
imagick::COLORSPACE_YCBCR
imagick::COLORSPACE_YCC
imagick::COLORSPACE_YIQ
imagick::COLORSPACE_YPBPR
imagick::COLORSPACE_YUV
imagick::COLORSPACE_CMYK
imagick::COLORSPACE_SRGB
imagick::COLORSPACE_HSB
imagick::COLORSPACE_HSL
imagick::COLORSPACE_HWB
imagick::COLORSPACE_REC601LUMA
imagick::COLORSPACE_REC709LUMA
imagick::COLORSPACE_LOG
treedepth
PHP.net does not define.
dither
In a dithered image, colors not available in the palette are approximated by a diffusion of colored pixels from within the available palette. The human eye perceives the diffusion as a mixture of the colors within it (see color vision). Dithering is analogous to the halftone technique used in printing. Dithered images, particularly those with relatively few colors, can often be distinguished by a characteristic graininess, or speckled appearance.
-http://en.wikipedia.org/wiki/Dithering
measureError
PHP.net does not define.
Return Values
Returns TRUE on success.
Errors/Exceptions
Throws ImagickException on error.

Example


<?php 
$image 
= new Imagick("opossum.jpg"); 
$image->quantizeImage(15imagick::COLORSPACE_RGB5FALSETRUE); 
header('Content-type: image/jpeg'); 
echo 
$image;
?>


^


Created by DJ Mike from Santa Barbara

DJ Mike


Dance Away Santa Barbara's Home Page
<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>