---
application: "Intervention Image"
version: "Version 2"
status: "eol"
---

# Image::ellipse

## Draw an ellipse to the current image



> public Intervention\Image\Image ellipse(int $width, int $height, int $x, int $y, [Closure $callback])

Draw a **colored** ellipse at given **x, y, coordinates**. You can define **width** and **height** and set the **appearance** of the circle by an optional closure callback.

### Parameters

#### width
width of the ellipse. Default: `10`

#### height
The ellipse height. Default: `10`

#### x
x-coordinate of the center.

#### y
y-coordinate of the center.

#### callback (optional)
Define appearance of ellipse. See examples below. Use the following methods to pass details.

> public Intervention\Image\AbstractShape background(string $color)

Define the background-color of the ellipse in one of the available [color formats](https://image.intervention.io/v2/getting-started/formats.md).

> public Intervention\Image\AbstractShape border(integer $width, string $color)

Define the border of the ellipse. Set width as pixels in the first and the border-color in one of the available [color formats](https://image.intervention.io/v2/getting-started/formats.md) as second parameter.

### Return Values
Instance of `Intervention\Image\Image`

### Examples

```php
// create empty canvas with background color
$img = Image::canvas(800, 600, '#ddd');

// draw a filled blue ellipse
$img->ellipse(25, 30, 50, 50, function ($draw) {
    $draw->background('#0000ff');
});

// draw a filled blue ellipse with red border
$img->ellipse(60, 120, 100, 100, function ($draw) {
    $draw->background('#0000ff');
    $draw->border(1, '#ff0000');
});

// draw an empty ellipse with a 5px border
$img->ellipse(150, 200, 300, 200, function ($draw) {
    $draw->border(5, 'fff');
});
```


### See also

- [pixel](https://image.intervention.io/v2/api/pixel.md)
- [line](https://image.intervention.io/v2/api/line.md)
- [rectangle](https://image.intervention.io/v2/api/rectangle.md)
- [circle](https://image.intervention.io/v2/api/circle.md)
- [polygon](https://image.intervention.io/v2/api/polygon.md)

---

## Become a Sponsor

### Intervention Image needs your help to keep the project going

Intervention Image is non-commercial, open source licensed and completely free to use. The considerable
effort required to maintain and develop the software is only possible with the financial support
of sponsors. There are two ways in which you can support this project.

- Support via [GitHub Sponsors](https://github.com/sponsors/Intervention)
- Support via [Ko-Fi](https://ko-fi.com/interventionphp)