pixel — Draw a single pixel

Description

public Intervention\Image\Image pixel(mixed $color, integer $pos_x, integer $pos_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.

pos_x

X-Coordinate of the pixel.

pos_y

Y-Coordinate of the pixel.

Return Values

Instance of Intervention\Image\Image

Examples

  1. // create empty canvas with background color
  2. $img = Image::canvas(100, 100, '#ddd');
  3. // draw a blue pixel
  4. $img->pixel('#0000ff', 32, 32);
  5. // draw a red pixel
  6. $img->pixel('#ff0000', 64, 64);

See also