Click or drag to resize
Accord.NET (logo)

UnmanagedImageGetPixel Method (Int32, Int32)

Get color of the pixel with the specified coordinates.

Namespace:  Accord.Imaging
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.7.0
Syntax
public Color GetPixel(
	int x,
	int y
)
Request Example View Source

Parameters

x
Type: SystemInt32
X coordinate of the pixel to get.
y
Type: SystemInt32
Y coordinate of the pixel to get.

Return Value

Type: Color
Return pixel's color at the specified coordinates.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionThe specified pixel coordinate is out of image's bounds.
UnsupportedImageFormatExceptionPixel format of this image is not supported by the method.
Remarks

Note Note
In the case if the image has 8 bpp grayscale format, the method will return a color with all R/G/B components set to same value, which is grayscale intensity.

Note Note
The method supports only 8 bpp grayscale images and 24/32 bpp color images so far.

See Also