Click or drag to resize
Accord.NET (logo)

ImageIsGrayscale Method

Check if specified 8 bpp image is grayscale.

Namespace:  Accord.Imaging
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.8.0
Syntax
public static bool IsGrayscale(
	this Bitmap image
)
Request Example View Source

Parameters

image
Type: System.DrawingBitmap
Image to check.

Return Value

Type: Boolean
Returns true if the image is grayscale or false otherwise.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Bitmap. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
The methods checks if the image is a grayscale image of 256 gradients. The method first examines if the image's pixel format is Format8bppIndexed and then it examines its palette to check if the image is grayscale or not.
See Also