PHP | Imagick setResolution() Function Last Updated : 13 Dec, 2019 Comments Improve Suggest changes Like Article Like Report The Imagick::setResolution() function is an inbuilt function in PHP which is used to set the resolution for image. This function doesn't changes the actual resolution of a image but just sets it in the Imagick object before image is read or created, for changing image resolution use setImageResolution() function. This function needs to be called before reading image or creating it. Syntax: bool Imagick::setResolution( float $x_resolution, float $y_resolution ) Parameters: This function accepts two parameters as mentioned above and described below: $x_resolution: It specifies the horizontal resolution. $y_resolution: It specifies the vertical resolution. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below programs illustrate the Imagick::setResolution() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick(); // Set the resolution $imagick->setResolution(18, 13); // Create new image $imagick->newimage(100, 100, 'none'); // Read the properties of image print("<pre>".print_r($imagick->identifyImage(), true)."</pre>"); ?> Output: Array ( [imageName] => [mimetype] => image/x- [units] => Undefined [type] => Bilevel [colorSpace] => sRGB [compression] => Undefined [fileSize] => 0B [geometry] => Array ( [width] => 100 [height] => 100 ) // you can see the temporary resolution here [resolution] => Array ( [x] => 18 [y] => 13 ) [signature] => e7e2dcff542de95352682dc186432e98f0188084896773f1973276b0577d5305 ) Program 2: php <?php // Create a new imagick object $imagick = new Imagick(); // Set the resolution $imagick->setResolution(10, 10); // Read the image $imagick->readimage( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Read the properties of image print("<pre>".print_r($imagick->identifyImage(), true)."</pre>"); ?> Output: Array ( [imageName] => [mimetype] => image/png [format] => PNG (Portable Network Graphics) [units] => PixelsPerCentimeter [type] => TrueColorAlpha [colorSpace] => sRGB [compression] => Zip [fileSize] => 45.4KB [geometry] => Array ( [width] => 667 [height] => 184 ) // Here resolution is changed because new image is read [resolution] => Array ( [x] => 37.8 [y] => 37.8 ) [signature] => f64054f5bcb4cfb82c6126eff6d3d4e6be7d0e72d5620033442cecb4b9feabbd ) Reference: https://www.php.net/manual/en/imagick.setresolution.php Comment More infoAdvertise with us Next Article PHP | Imagick setResolution() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | Imagick setImageResolution() Function The Imagick::setImageResolution() function is an inbuilt function in PHP which is used to set the resolution of an image object.Syntax:Â Â bool Imagick::setImageResolution($x_resolution, $y_resolution) Parameters: This function accept two parameters as mentioned above and described below:Â Â $x_resolu 2 min read PHP | Imagick setOption() Function The Imagick::setOption() function is an inbuilt function in PHP which is used to set an option. Syntax: bool Imagick::setOption( string $key, string $value ) Parameters: This function accepts two parameters as mentioned above and described below: $key: It specifies the key for the option. $value: It 1 min read PHP | Gmagick setimageresolution() Function The Gmagick::setimageresolution() function is an inbuilt function in PHP which is used to set the resolution of an image object. Syntax: Gmagick Gmagick::setImageResolution($x_resolution, $y_resolution) Parameters: This function accept two parameters as mentioned above and described below: $x_resolu 2 min read PHP | Imagick setResourceLimit() Function The Imagick::setResourceLimit() function is an inbuilt function in PHP which is used to set the limit for a particular resource. Syntax: int Imagick::setResourceLimit( int $type, int $limit ) Parameters: This function accepts two parameters as mentioned above and described below: $type: It specifies 1 min read PHP | Imagick setSize() Function The Imagick::setSize() function is an inbuilt function in PHP which is used to set the size associated with an imagick object. Syntax: bool Imagick::setSize( int $columns, int $rows ) Parameters: This function accepts two parameters as mentioned above and described below: $columns: It specifies the 1 min read Like