Search code examples
c++libpng

How to get the alpha value of a pixel in libpng?


How can I get the alpha value of a pixel with the libpng.
The pixels values are stored int a std::vector<std::vector<uint8_t>>.
The RGB values are correctly decoded but the alpha value is sometimes 255 !
I thought that the alpha value should be between 0 and 1.
Thanks !


Solution

  • This comment from Benny K solved my issue : Both RGB and alpha values are generally 8-bit values, meanning integers in 0-255, where 255 is 1.0 or 100%.