The imagefilledellipse() function is an inbuilt function in PHP which is used to draw the filled ellipse. It draws the ellipse with specified center coordinate.
Syntax:
bool imagefilledellipse( $image, $cx, $cy, $width, $height, $color )
Parameters: This function accepts six parameters as mentioned above and described below:
- $image: The imagecreatetruecolor() function is used to create a blank image in a given size.
- $cx: x-coordinate of the center.
- $cy: y-coordinate of the center.
- $width: The ellipse width.
- $height: The ellipse height.
- $color: The fill color. A color identifier created with imagecolorallocate().
Return Value: This function returns TRUE on success or FALSE on failure.
Below programs illustrate the imagefilledellipse() function in PHP.
Program 1:
<?php // It create the size of image or blank image. $image = imagecreatetruecolor(500, 300); // Set the background color of image. $bg = imagecolorallocate($image, 205, 220, 200); // Fill background with above selected color. imagefill($image, 0, 0, $bg); // Set the color of an ellipse. $col_ellipse = imagecolorallocate($image, 0, 102, 0); // Function to draw the filled ellipse. imagefilledellipse($image, 250, 150, 400, 250, $col_ellipse); // Output of the image. header("Content-type: image/png"); imagepng($image); ?> |
Output:

Program 2:
<?php // It create the size of image or blank image. $image = imagecreatetruecolor(300, 500); // Set the background color of image. $bg = imagecolorallocate($image, 205, 220, 200); // Fill background with above selected color. imagefill($image, 0, 0, $bg); // set color of ellipse. $col_ellipse = imagecolorallocate($image, 0, 102, 0); // function to draw the filled ellipse with white color. imagefilledellipse($image, 150, 250, 250, 400, $col_ellipse); // output of the image. header("Content-type: image/png"); imagepng($image); ?> |
Output:

You can try making a circle too using the same function.
Related Article: PHP | imageellipse() Function
Reference: http://php.net/manual/en/function.imagefilledellipse.php
Recommended Posts:
- How to get the function name inside a function in PHP ?
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
- How to import config.php file in a PHP script ?
- PHP | imagecreatetruecolor() Function
- PHP | ImagickDraw getTextAlignment() Function
- PHP | Ds\Sequence last() Function
- Function to escape regex patterns before applied in PHP
- PHP | array_udiff_uassoc() Function
- PHP | geoip_continent_code_by_name() Function
- PHP | GmagickPixel setcolor() function
- PHP | opendir() Function
- PHP | cal_to_jd() Function
- PHP | stream_get_transports() Function
- PHP | Ds\Deque pop() Function
- PHP | SimpleXMLElement children() Function
- PHP | is_numeric() Function
- PHP | Imagick adaptiveSharpenImage() Function
- PHP | XMLWriter endDtdEntity() Function
- PHP | isset() 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.

