PHP | ImagickDraw rotate() Function Last Updated : 30 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The ImagickDraw::rotate() function is an inbuilt function of PHP which is used to apply the specified rotation to the current coordinate space. bool ImagickDraw::rotate( $degrees ) Parameters: This function accepts a single parameter $degrees which is used to hold the value of degree of rotation. Return Value: This function does not returns any value. Below programs illustrates the ImagickDraw::rotate() function in PHP: Program 1: php <?php // require_once('path/vendor/autoload.php'); // Create an Imagick Draw object $draw = new \ImagickDraw(); // Set the stroke color $strokeColor = new \ImagickPixel('Green'); // Set the fill color $fillColor = new \ImagickPixel('Red'); // Set the stroke opacity $draw->setStrokeOpacity(1); // Set the stroke color $draw->setStrokeColor('Green'); // Set the Fill Color $draw->setFillColor('Red'); // Set the stroke width $draw->setStrokeWidth(2); // Draw the rectangle $draw->rectangle(100, 200, 500, 400); // Set the stroke color $draw->setStrokeColor('black'); // Set the fill color $draw->setFillColor('lightgreen'); // Set the rotation $draw->rotate(10); // Draw the rectangle $draw->rectangle(100, 200, 500, 400); //Create an imagick object $imagick = new \Imagick(); // Set the image dimensions $imagick->newImage(600, 500, 'White'); // Set the image format $imagick->setImageFormat("png"); // Draw the image $imagick->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // require_once('path/vendor/autoload.php'); // Create an Imagick Draw object $draw = new \ImagickDraw(); // Set the stroke color $strokeColor = new \ImagickPixel('Green'); // Set the fill color $fillColor = new \ImagickPixel('Red'); // Set the stroke opacity $draw->setStrokeOpacity(1); // Set the stroke color $draw->setStrokeColor('Green'); // Set the Fill Color $draw->setFillColor('Red'); // Set the stroke width $draw->setStrokeWidth(2); $smoothPointsSet = [ [ ['x' => 10.0 * 5, 'y' => 10.0 * 5], ['x' => 30.0 * 5, 'y' => 90.0 * 5], ['x' => 25.0 * 5, 'y' => 10.0 * 5], ['x' => 50.0 * 5, 'y' => 50.0 * 5], ] ]; foreach ($smoothPointsSet as $points) { $draw->bezier($points); } // Set the stroke color $draw->setStrokeColor('black'); // Set the fill color $draw->setFillColor('lightgreen'); // Set the rotation angle $draw->rotate(15); foreach ($smoothPointsSet as $points) { $draw->bezier($points); } // Create an imagick object $imagick = new \Imagick(); // Set the image dimensions $imagick->newImage(350, 350, 'White'); // Set the image format $imagick->setImageFormat("png"); // Draw the image $imagick->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $imagick->getImageBlob(); ?> Output: Reference: http://php.net/manual/en/imagickdraw.rotate.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw rotate() Function sarthak_ishu11 Follow Improve Article Tags : Technical Scripter Web Technologies PHP Image-Processing PHP-function PHP-Imagick +2 More Similar Reads PHP | GmagickDraw rotate() Function The GmagickDraw::rotate() function is an inbuilt function in PHP which is used to apply the specified rotation to the current coordinate space. Syntax: GmagickDraw GmagickDraw::rotate( array $coordinates_array ) Parameters: This function accepts a single parameter $coordinates_array which is used to 2 min read PHP | ImagickDraw translate() Function The ImagickDraw::translate() function is an inbuilt function in PHP which is used to apply a translation to the current coordinate system. It applies a translation to the current coordinate system which moves the coordinate system origin to the specified coordinate. Syntax: bool ImagickDraw::transla 3 min read PHP | ImagickDraw scale() Function The ImagickDraw::scale() function is an inbuilt function in PHP which is used to adjust the scaling factor to apply in the horizontal and vertical directions to the current coordinate space. Syntax:Â bool ImagickDraw::scale( $x, $y ) Parameters: This function accepts two parameter as mentioned above 2 min read PHP | ImagickDraw point() Function The ImagickDraw::point() function is an inbuilt function in Imagick library of PHP which is used to draw a point. This function uses current stroke color and stroke thickness at the specified coordinates. Syntax: bool ImagickDraw::point( $x, $y ) Parameters: This function accepts two parameters as m 1 min read PHP | ImagickDraw rectangle() Function The ImagickDraw::rectangle() function is an inbuilt function in Imagick library of PHP which is used to draw a rectangle. Syntax: bool ImagickDraw::rectangle( $x1, $y1, $x2, $y2 ) Parameters: This function accepts four parameters as mentioned above and described below: $x1: This parameter takes the 1 min read PHP | ImagickDraw popPattern() Function The ImagickDraw::popPattern() function is an inbuilt function in PHP which is used to terminate a pattern definition which contains a design to be applied. Syntax: bool ImagickDraw::popPattern( void ) Parameters:This function doesnât accepts any parameter. Return Value: This function returns TRUE on 2 min read PHP | ImagickDraw pop() Function The ImagickDraw::pop() function is an inbuilt function in PHP which is used to destroy the current ImagickDraw in the stack and returns the previously pushed ImagickDraw. For every pop() function there must have already been an equivalent push() function. Syntax: bool ImagickDraw::pop( void ) Parame 2 min read PHP | Imagick rotateImage() Function 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. Syntax: bool Imagick::rotateImage( $background, $degrees ) Parameters: This function accepts two parameters as mentioned above and describ 1 min read PHP | ImagickDraw roundRectangle() Function The ImagickDraw::roundRectangle() function is an inbuilt function in Imagick library of PHP which is used to draw a rounded rectangle. Syntax: bool ImagickDraw::roundRectangle( $x1, $y1, $x2, $y2, $rx, $ry ) Parameters: This function accept six parameters as mentioned above and described below: $x1: 2 min read PHP | ImagickDraw popDefs() Function The ImagickDraw::popDefs() function is an inbuilt function in PHP which is used to terminate a definition list. These are usually used to define draw commands which should be safely processed earlier for the sake of efficiency. This command has no impact on the looks of the draw commands. Syntax: bo 2 min read Like