PHP | Imagick setImageResolution() Function Last Updated : 06 Oct, 2021 Comments Improve Suggest changes Like Article Like Report 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_resolution: It is required parameter which specifies the x-axis resolution.$y_resolution: It is required parameter which specifies the y-axis resolution. Return Value: This function returns the resolution as an array.Below program illustrates the Imagick::setImageResolution() function in PHP:Original Image: Program 1: php <?php $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-15.png'); // Getting Resolution of image // using getimageresolution function $res = $imagick->getImageResolution(); echo "X = ".$res['x'] . "</br>"; echo "Y = ".$res['y'] . "</br>"; // Function to set image resolution $imagick->setImageResolution(50, 50); echo "After Set Resolution: </br>"; // Getting Resolution of image // using getimageresolution function $res = $imagick->getImageResolution(); echo "X = " . $res['x'] . "</br>"; echo "Y = " . $res['y'] . "</br>"; ?> Output: X = 37.8 Y = 37.8 After Set Resolution: X = 50 Y = 50 Original Image: Program 2: php <?php $string = "Computer Science portal for Geeks!"; // Creating new image of above String // and add color and background $im = new Imagick(); $draw = new ImagickDraw(); // Fill the color in image $draw->setFillColor(new ImagickPixel('green')); // Set the text font size $draw->setFontSize(50); $matrix = $im->queryFontMetrics($draw, $string); $draw->annotation(0, 40, $string); $im->newImage($matrix['textWidth'], $matrix['textHeight'], new ImagickPixel('white')); // Draw the image $im->drawImage($draw); echo "Before: </br>"; // Getting Resolution of created image // using getimageresolution function $res = $im->getImageResolution(); echo "X = ".$res['x'] . "</br>"; echo "Y = ".$res['y'] ." </br>"; // Set image resolution (50, 50) $im->setImageResolution(50, 50); echo "After:</br> "; // Getting Resolution of created image // using getimageresolution function $res = $im->getImageResolution(); echo "X = ".$res['x'] . "</br>"; echo "Y = ".$res['y'] ." </br>"; ?> Output: Before: X = 0 Y = 0 After: X = 50 Y = 50 Reference: http://php.net/manual/en/imagick.setimageresolution.php Comment More infoAdvertise with us Next Article PHP | Imagick setImageResolution() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP Image-Processing PHP-function PHP-Imagick +1 More Similar Reads 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 setResolution() Function 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 setImageResoluti 2 min read PHP | Imagick setImageCompression() Function The Imagick::setImageCompression() function is an inbuilt function in PHP which is used to set the image compression type. Syntax: bool Imagick::setImageCompression( int $compression ) Parameters: This function accepts a single parameter $compression which holds an integer matching to one of Imagic 1 min read PHP | Imagick setImageExtent() Function The Imagick::setImageExtent() function is an inbuilt function in PHP which is used to set the image size. This function doesn't scales the image but crops the unwanted parts. Syntax: bool Imagick::setImageExtent( int $columns, int $rows ) Parameters: This function accepts two parameters as mentioned 1 min read PHP | Imagick setImageProfile() Function The Imagick::setImageProfile() function is an inbuilt function in PHP which is used to set the named profile to the Imagick object. Syntax: bool Imagick::setImageProfile( string $name, string $profile ) Parameters:This function accepts two parameters as mentioned above and described below: $name: It 1 min read PHP | Imagick setImageUnits() Function The Imagick::setImageUnits() function is an inbuilt function in PHP which is used to set the units of resolution of a particular image.Syntax:  bool Imagick::setImageUnits( $units ) Parameters: This function accepts single parameter $units which is used to specify the units to be set for image. Res 2 min read PHP | Imagick setImageScene() Function The Imagick::setImageScene() function is an inbuilt function in PHP which is used to set the image scene. The value of scene contains an integer value. Syntax: bool Imagick::setImageScene( int $scene ) Parameters: This function accepts a single parameter $scene which holds the scene. Return Value: T 1 min read PHP | Imagick setImageWhitePoint() Function The Imagick::setImageWhitePoint() function is an inbuilt function in PHP which is used to set the image chromaticity white point. Syntax: bool Imagick::setImageWhitePoint( float $x, float $y ) Parameters:This function accepts two parameters as mentioned above and described below: $x: It specifies th 1 min read PHP | Imagick setImageDepth() Function The Imagick::setImageDepth() function is an inbuilt function in PHP which is used to set the depth of a particular image.Syntax:  bool Imagick::setImageDepth( $depth ) Parameters: This function accepts a single parameter $depth which is an integer value and used to set the depth of image.Return Val 2 min read PHP | Imagick setImageFormat() Function The Imagick::setImageFormat() function is an inbuilt function in PHP which is used to set the format of a particular image in a sequence.Syntax:  bool Imagick::setImageFormat( string $format ) Parameters: This function accepts a single parameter $format which holds a string value of the image forma 1 min read Like