在线文档教程
PHP
Image/ImageMagick

Imagick::setCompressionQuality

Imagick::setCompressionQuality

(PECL imagick 0.9.10-0.9.9)

Imagick::setCompressionQuality — Sets the object's default compression quality

Description

bool Imagick::setCompressionQuality ( int $quality )

Sets the object's default compression quality.

Caution

This method only works for new images e.g. those created through Imagick::newPseudoImage. For existing images you should use Imagick::setImageCompressionQuality().

Parameters

quality

Return Values

Returns TRUE on success.

Examples

Example #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( } ?>

← Imagick::setCompression

Imagick::setFilename →

© 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

https://secure.php.net/manual/en/imagick.setcompressionquality.php