Syntax:bool Imagick::setCompressionQuality (int $quality)
Parameters:This function takes one parameter,
$quality,which contains an integer value representing the quality.
Return value:this the function returns TRUE on success.The following programs illustrate the
Imagick::setCompressionQuality() functionin PHP:
Program 1:
// Create a new imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
);
// Set compression quality
$imagick
-> setCompressionQuality (25);
// Get compression quality
$compressionQuality
=
$imagick
-> getCompressionQuality();
echo
$compressionQuality
;
?>
Output:25
Program 2:
// Create a new imagick object
$imagick
=
new
Imagick();
// Set compression quality to 1
$imagick
-> setCompressionQuality (1);
// Write a title on the image
$imagick
-> newPseudoImage (800, 320,
"caption: GeekforGeeks "
);
$imagick
-> floodfillPaintImage (
"orange"
, 1,
"white"
, 1, 1, false);
// Show output
$imagick
-> setformat (
’jpg’
);
header (
"Content-Type: image / jpg"
);
echo
$imagick
-> getImageBlob();
?>
Output: Link: https://www.php.net/manual/en/imagick.setcompressionquality.php