The ImagickDraw::circle() function is an inbuilt function in Imagick library of PHP which is used to draw a circle.
Syntax:
bool ImagickDraw::circle( $ox, $oy, $px, $py )
Parameters: This function accepts four parameters as mentioned above and described below:
- $ox: This parameter takes the value of origin x-coordinate.
- $oy: This parameter takes the value of origin y-coordinate.
- $px: This parameter takes the value of perimeter x-coordinate.
- $py: This parameter takes the value of perimeter y-coordinate.
Return Value: This function does not return any value.
Below program illustrates the ImagickDraw::circle() function in PHP:
Program:
<?php // require_once('vendor/autoload.php'); // Create an ImagickDraw object $draw = new \ImagickDraw(); // Create ImagickPixel object $strokeColor = new \ImagickPixel('Red'); $fillColor = new \ImagickPixel('Green'); // Set the color, opacity of image $draw->setStrokeOpacity(1); $draw->setStrokeColor('Red'); $draw->setFillColor('Green'); // Set the width and height of image $draw->setStrokeWidth(7); $draw->setFontSize(72); // Function to draw circle $draw->circle(250, 250, 100, 150); $imagick = new \Imagick(); $imagick->newImage(500, 500, 'White'); $imagick->setImageFormat("png"); $imagick->drawImage($draw); // Display the output image header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> |
Output:

Reference: http://php.net/manual/en/imagickdraw.circle.php
Recommended Posts:
- PHP | ImagickDraw getTextAlignment() Function
- PHP | ImagickDraw scale() Function
- PHP | ImagickDraw polygon() Function
- PHP | ImagickDraw roundRectangle() Function
- PHP | ImagickDraw arc() Function
- PHP | ImagickDraw bezier() Function
- PHP | ImagickDraw rectangle() Function
- PHP | ImagickDraw line() Function
- PHP | ImagickDraw point() Function
- PHP | ImagickDraw skewX() Function
- PHP | ImagickDraw setStrokeWidth() Function
- PHP | ImagickDraw translate() Function
- PHP | ImagickDraw setStrokeOpacity() Function
- PHP | ImagickDraw setGravity() Function
- PHP | ImagickDraw setFillColor() Function
- PHP | ImagickDraw setFont() Function
- PHP | ImagickDraw setFontStyle() Function
- PHP | ImagickDraw setFontFamily() Function
- PHP | ImagickDraw setFontSize() Function
- PHP | ImagickDraw setFontWeight() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

