Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

PHP | Imagick rotateImage() Function

  • Difficulty Level : Easy
  • Last Updated : 26 Aug, 2019

The Imagick::rotateImage() function is an inbuilt function in PHP which is used to rotate an image by a given angle and the empty spaces filled with given color.


bool Imagick::rotateImage( $background, $degrees )

Parameters: This function accepts two parameters as mentioned above and described below:

  • $background: This parameter is used to set the background color of image. Datatype of this can be string as well as float.
  • $degrees: This parameter is used to set the angle by which the image is rotated. The rotation angle is interpreted as clockwise.

Return Value: This function returns True on success.

Below program illustrate Imagick::rotateImage() function in PHP:
Original Image:


// require_once('path/vendor/autoload.php');
// Create a new imagick object
$image = new Imagick(
// Function to rotate an Image
$image->rotateimage('green', 25);
header("Content-Type: image/jpg");
// Display the output
echo $image->getImageBlob();


Related Articles:


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!