Friday, 23 August 2013

Convert BMP to PNG while preserving alpha channel

Convert BMP to PNG while preserving alpha channel

I have an image stored in BMP format and would like to convert it to PNG
using imagemagick.
I looked at the pixels in a hex viewer and noticed that they are stored in
32bpp, so there is an alpha channel. The transparent pixels have RGBA
value (255, 255, 255, 0), and paint.NET is picking them up as white pixels
probably because it doesn't expect BMP's to have transparent pixels?
Anyways, the command I used is
convert -alpha on -quality 95 in.bmp out.png
However, when I opened the resulting image in Paint.NET (which usually
interprets transparent pixels properly), those transparent pixels were
still white.
Am I converting the images incorrectly? I would like the pixels with an
alpha value of 0 to appear transparent in the image editor that I commonly
use.

No comments:

Post a Comment