Determine if Alpha Channel is Used in an Image
Posted
by Otaku
on Stack Overflow
See other posts from Stack Overflow
or by Otaku
Published on 2010-06-17T19:16:47Z
Indexed on
2010/06/17
19:33 UTC
Read the original article
Hit count: 289
As I'm bringing in images into my program, I want to determine if:
- they have an alpha-channel
- if that alpha-channel is used
#1 is simple enough with using Image.IsAlphaPixelFormat
. For #2 though, other than looping through every single pixel, is there a simple way I can determine if at least one of the pixels has an alpha channel that is used (i.e. set to some other value than 255
)? All I need back is a boolean and then I'll make determination as to whether to save it out to 32-bit or 24-bit.
© Stack Overflow or respective owner