HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Imagick::posterizeImage

← polaroidWithTextAndMethod   Quantum →
Reduces the image to a limited number of color level.

Example

function posterizeImage($image_path, $dither, $numberLevels)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->posterizeImage($numberLevels, $dither);
    $imagick->setImageFormat('png');
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}