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 JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav 11 min read Web Development Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De 5 min read React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications 15+ min read JavaScript Interview Questions and Answers JavaScript (JS) is the most popular lightweight, scripting, and interpreted programming language. JavaScript is well-known as a scripting language for web pages, mobile apps, web servers, and many other platforms. Both front-end and back-end developers need to have a strong command of JavaScript, as 15+ min read React Tutorial React is a JavaScript Library known for front-end development (or user interface). It is popular due to its component-based architecture, Single Page Applications (SPAs), and Virtual DOM for building web applications that are fast, efficient, and scalable.Applications are built using reusable compon 8 min read Decorators in Python In Python, decorators are a powerful and flexible way to modify or extend the behavior of functions or methods, without changing their actual code. A decorator is essentially a function that takes another function as an argument and returns a new function with enhanced functionality. Decorators are 10 min read Sliding Window Technique Sliding Window Technique is a method used to solve problems that involve subarray or substring or window. The main idea is to use the results of previous window to do computations for the next window. This technique is commonly used in algorithms like finding subarrays with a specific sum, finding t 13 min read AVL Tree Data Structure An AVL tree defined as a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees for any node cannot be more than one. Example of an AVL Tree:The balance factors for different nodes are : 12 :1, 8:1, 18:1, 5:1, 11:0, 17:0 and 4:0. Since all differences 4 min read Domain Name System (DNS) DNS is a hierarchical and distributed naming system that translates domain names into IP addresses. When you type a domain name like www.geeksforgeeks.org into your browser, DNS ensures that the request reaches the correct server by resolving the domain to its corresponding IP address.Without DNS, w 8 min read What is a Neural Network? Neural networks are machine learning models that mimic the complex functions of the human brain. These models consist of interconnected nodes or neurons that process data, learn patterns, and enable tasks such as pattern recognition and decision-making.In this article, we will explore the fundamenta 14 min read Like