Get color of the pixel with the specified coordinates.

Namespace:  AForge.Imaging
Assembly:  AForge.Imaging (in AForge.Imaging.dll) Version: 2.2.5.0 (2.2.5.0)

Syntax

C#
public Color GetPixel(
	int x,
	int y
)

Parameters

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

Return Value

Return pixel's color at the specified coordinates.

Remarks

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:The method supports only 8 bpp grayscale images and 24/32 bpp color images so far.

Exceptions

ExceptionCondition
System..::.ArgumentOutOfRangeExceptionThe specified pixel coordinate is out of image's bounds.
AForge.Imaging..::.UnsupportedImageFormatExceptionPixel format of this image is not supported by the method.

See Also