I have a .NET BitmapSource object. I would like to read the four pixels in corners of the bitmap, and test whether all of them are darker than white. How can I do that?
Edit: I wouldn't mind converting this object to another type with a better API.
I have a .NET BitmapSource object. I would like to read the four pixels in corners of the bitmap, and test whether all of them are darker than white. How can I do that?
Edit: I wouldn't mind converting this object to another type with a better API.
BitmapSource has a CopyPixels method that can be used to get one or more pixel values.
A helper method that gets a single pixel value at a given pixel coordinate may look like shown below. Note that it perhaps has to be extended to support all required pixel formats.
You would use the method like this: