When I open png file:
CImg<unsigned char> image("image.png");
...I expect to get 4 channel (RGBA) image. But I always get 3 channel (RGB) image instead (even if the image is semitransparent): image.spectrum() returns 3 instead of 4.
In my application, I always need to get 4 channels when I open PNG file. CImg looks like popular library with many useful features (some of which may be useful in the future in my image processing application), so I find it hard to believe that it is impossible to open PNG file with alpha channel without losing it. Any suggestions?
If CImg is not very good tool for working with PNG files, feel free to suggest some other simple to use library. Only important thing for me at this moment is to be able to read and write PNG as 4 channel unsigned char image and to have functions to get image dimensions and data (like image.width() or image.data() ).