c++ - Problem using freeimage to accurately determine whether alpha channel is included
巴扎黑
巴扎黑 2017-06-10 09:48:50
0
1
968

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....

巴扎黑
巴扎黑

reply all (1)
大家讲道理

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, useFreeImage_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.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!