Imagick::setCompressionQuality
(PECL imagick 2, PECL imagick 3)
Imagick::setCompressionQuality — Sets the object's default compression quality
Beschreibung
$quality
): boolSets the object's default compression quality.
This method only works for new images e.g. those created through Imagick::newPseudoImage. For existing images you should use Imagick::setImageCompressionQuality().
Rückgabewerte
Liefert true
bei Erfolg.
Beispiele
Beispiel #1 Imagick::setCompressionQuality()
<?php
function setCompressionQuality($imagePath, $quality) {
$backgroundImagick = new \Imagick(realpath($imagePath));
$imagick = new \Imagick();
$imagick->setCompressionQuality($quality);
$imagick->newPseudoImage(
$backgroundImagick->getImageWidth(),
$backgroundImagick->getImageHeight(),
'canvas:white'
);
$imagick->compositeImage(
$backgroundImagick,
\Imagick::COMPOSITE_ATOP,
0,
0
);
$imagick->setFormat("jpg");
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>