Have any friends who have used c freeimage asked a question here:
When reading png images, some pngs have alpha channels (rgba), and some pngs have rgb. I want to know how to use freeimage to accurately determine whether they contain alpha channels?
Because I use some functions such as FreeImage_GetColorType, I find that the results returned are often incorrect....
大家讲道理2017-06-10 09:50:50
FreeImage_GetBPP()
Returns how many bits are used for each pixel. RGB is 24bit and RGBA is 32bit, which is equivalent to 8bit for one channel.
If you want to consider it all, use FreeImage_GetImageType()
to get the type. There are some rare image types that are not standard
FIT_BITMAP, such as FIT_FLOAT. Because float uses 32bit, there is only 1 channel when bpp=32.