How to convert 32-bit BMP format image with "alpha" channel into PNG format using ATL::CImage class

5 days ago 9
ARTICLE AD BOX

We use 32-bit RGB bitmaps with information encoded into the 4th byte, often used as an "alpha" channel, but in our case used to encode other metadata. We have been saving/loading 32-bit .bmp format images for years no trouble, all using the (old) ATL::CImage class.

We want to move to PNG format to save disk space, but can only achieve one of two outcomes:

m_hasAlphaChannel = FALSE: PNG image is saved with alpha channel set to 0xFF everywhere.

m_hasAlphaChannel = TRUE: All pixel values are multiplied by the alpha value and then saved, losing all the information in the image each time the "alpha" value is zero (typical case).

What combination of API calls can we use to ensure that the unmodified pixel values are saved to the image along with our metadata?

Read Entire Article