Reputation: 2503
I am using a method to get a pixel of the image to check if this point is transparent or not. I am using GetPixel that returns a System.Drawing.Color with a 32bit color info.
This struct have the "A" property where I can get the alpha value of pixel, according to this MSDN topic.
Code:
using (Bitmap bmp = new Bitmap(path))
{
Color pixel = bmp.GetPixel(0, 0);
if (pixel.A == 0)
// This is a fully transparent pixel
else
// This is not a fully transparent pixel
}
How are the correct way to check if a pixel is opaque or not?
Upvotes: 1
Views: 3013
Reputation: 9024
For the alpha channel the values are:
Opaque = 255
Translucent = 1-254
Transparent = 0
Upvotes: 4