Imagick::posterizeImage

(PECL imagick 2, PECL imagick 3)

Imagick::posterizeImageReduces the image to a limited number of color level

Description

public Imagick::posterizeImage(int $levels, bool $dither): bool

Reduces the image to a limited number of color level.

Parameters

levels

dither

Return Values

Returns true on success.

Examples

Example #1 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);

?>

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top