Imagick::quantizeImage

(PECL imagick 2, PECL imagick 3)

Imagick::quantizeImageAnaliza los colores dentro de una imagen de referencia

Descripción

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

Parámetros

numberColors

colorspace

treedepth

dither

measureError

Valores devueltos

Devuelve true en caso de éxito.

Errores/Excepciones

Lanza ImagickException en caso de error.

Ejemplos

Ejemplo #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();
}

?>
To Top