HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue


← orderedDitherImage   paintOpaqueImage →

From the ImageMagick manual for MagickOrderedPosterizeImage: A string containing the name of the threshold dither map to use, followed by zero or more numbers representing the number of color levels tho dither between.

For example: "o3x3,6" generates a 6 level posterization of the image with a ordered 3x3 diffused pixel dither being applied between each level. While checker,8,8,4 will produce a 332 colormaped image with only a single checkerboard hash pattern (50 grey) between each color level, to basically double the number of color levels with a bare minimim of dithering.

The predefined posterization types available are defined in the ImageMagick file: config/thresholds.xml
Doesn't exist on ImageMagick 7 - TODO - need to find equivalent.
function orderedPosterizeImage($image_path, $orderedPosterizeType)
    $imagick = new \Imagick(realpath($image_path));
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();