This documentation is for the old version. Go to the latest Graphics Mill docs

Bitmap.SetPixel Method

Sets pixel value at the specified coordinates.

Namespace: Aurigma.GraphicsMill
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)


Visual Basic
Public Sub SetPixel ( _
	x As Integer, _
	y As Integer, _
	color As Color _
public void SetPixel(
	int x,
	int y,
	Color color



Type: System.Int32

Horizontal position of the pixel.

Type: System.Int32

Vertical position of the pixel.

Type: Aurigma.GraphicsMill.Color

Color value to put into the bitmap at specified coordinates. It is recommended to make sure that this object has the same color space as the bitmap itself. If color spaces are not match (e.g. bitmap is CMYK and this color is RGB), color will be automatically converted, but no color management will be applied.


This method was implemented for easy but slow access to pixels. It works ideally if you need to set one pixel value, for example, when you implement pencil tool. However if you need iterate each pixel in bitmap, it will work too slow. In this case you should consider using LockBits() method instead. LockBits() will provide you a direct access to pixels.


Visual Basic
bitmap.SetPixel(120, 100, Aurigma.GraphicsMill.RgbColor.Red)

Dim color As Aurigma.GraphicsMill.RgbColor = bitmap.GetPixel(100, 80)
bitmap.SetPixel(120, 100, Aurigma.GraphicsMill.RgbColor.Red);

Aurigma.GraphicsMill.RgbColor color =
    (Aurigma.GraphicsMill.RgbColor)(bitmap.GetPixel(100, 80));

See Also