update : 2015.11.03
php.shukuma.com

검색:
 
 
Sets the object's default compression quality

Imagick::setCompressionQuality

(PECL imagick 0.9.10-0.9.9)

Imagick::setCompressionQualitySets the object's default compression quality

설명

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().

인수

quality

반환값

성공시에 TRUE를 반환합니다.

예제

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

?>