Method IsBlackAndWhite
IsBlackAndWhite()
Determines whether the image is strictly black and white: every pixel is either pure black (all channels 0) or pure white (all channels 255), with no intermediate values. Works for any supported pixel format (GRAY8, RGB24, RGBA32).
public bool IsBlackAndWhite()
Returns
- bool
trueif every pixel is pure black or pure white;falseotherwise, or if the image is empty.
Remarks
The check operates on raw bytes regardless of pixel format. A pixel is black when all its bytes are 0x00 and white when all its bytes are 0xFF. Any other byte value means the image is not black and white. For RGBA32, this means the alpha channel must also be 0 or 255 and must match the color channels (fully transparent black or fully opaque white).
Exceptions
- ObjectDisposedException
Thrown if this instance has been disposed.