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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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: