Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

PHP | Imagick getImageCompressionQuality() Function

  • Last Updated : 19 Nov, 2019

The Imagick::getImageCompressionQuality() function is an inbuilt function in PHP that is employed to induce the present image’s compression quality.

Syntax:

int Imagick::getImageCompressionQuality( void )

Parameters: This function does not accept any parameters.

Return Value: This function returns a whole number value containing the current image’s compression quality.

Below programs illustrate the Imagick::getImageCompressionQuality() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Get the Compression quality
$compressionQuality = $imagick->getImageCompressionQuality();
  
echo $compressionQuality;
?>

Output:

0 // which is the default value.

Program 2:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Set the Compression quality
$imagick->setImageCompressionQuality(65);
  
// Get the Compression quality
$compressionQuality = $imagick->getImageCompressionQuality();
  
echo $compressionQuality;
?>

Output:

65

Reference: https://www.php.net/manual/en/imagick.getimagecompressionquality.php

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!