Php/docs/imagick.posterizeimage

来自菜鸟教程
跳转至:导航、​搜索

Imagick::posterizeImage

(PECL imagick 2, PECL imagick 3)

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


说明

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

Reduces the image to a limited number of color level.


参数

levels
dither


返回值

成功时返回 true


范例

Example #1 Imagick::posterizeImage()

<?phpfunction 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);?>