array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'imagick.quantizeimage.php', 1 => 'Imagick::quantizeImage', 2 => 'Analyzes the colors within a reference image', ), 'up' => array ( 0 => 'class.imagick.php', 1 => 'Imagick', ), 'prev' => array ( 0 => 'imagick.profileimage.php', 1 => 'Imagick::profileImage', ), 'next' => array ( 0 => 'imagick.quantizeimages.php', 1 => 'Imagick::quantizeImages', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/imagick/imagick/quantizeimage.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Imagick::quantizeImage

(PECL imagick 2, PECL imagick 3)

Imagick::quantizeImageAnalyzes the colors within a reference image

Опис

public Imagick::quantizeImage(
    int $numberColors,
    int $colorspace,
    int $treedepth,
    bool $dither,
    bool $measureError
): bool

Параметри

numberColors

colorspace

treedepth

dither

measureError

Значення, що повертаються

Повертає true в разі успіху.

Помилки/виключення

Кидає ImagickException в разі помилки.

Приклади

Приклад #1 Imagick::quantizeImage()

<?php
function quantizeImage($imagePath, $numberColors, $colorSpace, $treeDepth, $dither) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->quantizeImage($numberColors, $colorSpace, $treeDepth, $dither, false);
$imagick->setImageFormat('png');
header("Content-Type: image/png");
echo
$imagick->getImageBlob();
}

?>