Imagick::posterizeImage

(PECL imagick 2.0.0)
Reduces the image to a limited number of color level
bool Imagick::posterizeImage ( int $levels, bool $dither )

Reduces the image to a limited number of color level.

Parameters:
levels

Reduces the image to a limited number of color level.

dither

Reduces the image to a limited number of color level.

Returns:

Returns TRUE on success.

Examples:
Imagick::posterizeImage()
<?php
function posterizeImage($imagePath, $posterizeType, $numberLevels) {
    $imagick = new \Imagick(realpath($imagePath));
    $imagick->posterizeImage($numberLevels, $posterizeType);
    $imagick->setImageFormat('png');
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}

posterizeImage($imagePath, \Imagick::DITHERMETHOD_RIEMERSMA, 8);

?>

doc_php
2016-02-24 16:01:13
Comments
Leave a Comment

Please login to continue.