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

# Image::pixel

## Draw a single pixel to the current image



> public Intervention\Image\Image pixel(mixed $color, integer $x, integer $y)

Draw a single pixel in given **color** on **x, y position**.

### Parameters

#### color
The color of the pixel. Pass a color in one of the different [color formats](https://image.intervention.io/v2/getting-started/formats.md).

#### x
x-coordinate of the pixel.

#### y
y-coordinate of the pixel.

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

### Examples

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

// draw a blue pixel
$img->pixel('#0000ff', 32, 32);

// draw a red pixel
$img->pixel('#ff0000', 64, 64);
```

### See also

- [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)
- [ellipse](https://image.intervention.io/v2/api/ellipse.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)