PHP | ImagickDraw rectangle() Function Last Updated : 30 Aug, 2019 Comments Improve Suggest changes Like Article Like Report 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 value of x coordinate of the top left corner. $y1: This parameter takes the value of y coordinate of the top left corner. $x2: This parameter takes the value of x coordinate of the bottom right. $y2: This parameter takes the value of y coordinate of the bottom right. Return Value: This function returns TRUE on success. Below program illustrate ImagickDraw rectangle() function in PHP: Program: php <?php // require_once('vendor/autoload.php'); // Create ImagickDraw object $draw = new \ImagickDraw(); $draw->setStrokeColor('Green'); $draw->setFillColor('Red'); $draw->setStrokeWidth(7); $draw->rectangle(40, 30, 200, 260); // Create an image object which the draw // commands can be rendered into $image = new \Imagick(); $image->newImage(300, 300, 'White'); $image->setImageFormat("png"); // Render the draw commands in the ImagickDraw object // into the image. $image->drawImage($draw); // Send the image to the browser header("Content-Type: image/png"); echo $image->getImageBlob(); ?> Output: Reference: http://php.net/manual/en/imagickdraw.rectangle.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw rectangle() Function S sarthak_ishu11 Follow Improve Article Tags : Misc Technical Scripter Web Technologies PHP Image-Processing PHP-function PHP-Imagick +3 More Practice Tags : Misc Similar Reads PHP | GmagickDraw rectangle() Function The GmagickDraw::rectangle() function is an inbuilt function in PHP which is used to draw the rectangle. Syntax: public GmagickDraw::rectangle( $x1, $y1, $x2, $y2 ) Â Parameters:This function accepts four parameters as mentioned above and described below: $x1: This parameter takes the value of x coo 2 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 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 | GmagickDraw roundrectangle() Function The GmagickDraw::roundrectangle() function is an inbuilt function in PHP which is used to draw a rounded rectangle. Syntax: public GmagickDraw::rectangle( $x1, $y1, $x2, $y2, $rx, $ry) Â Parameters:This function accepts four parameters as mentioned above and described below: $x1: This parameter take 2 min read PHP | ImagickDraw rotate() Function 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. Re 2 min read Like