Page 1 of 1

BMP4 to BMP3 - changing alpha from black to white?

Posted: 2009-06-21T04:32:08-07:00
by Steve
Hi,

When I convert a 32-bit BMP to a 24-bit BMP the alpha channel displays as black in the
result. I'd like to change this to another colour (white).

It must be easy ... but after four hours of searching I'm still stuck. Can someone put me
out of my misery with a quick one liner.

Thanks, Steve.

Re: BMP4 to BMP3 - changing alpha from black to white?

Posted: 2009-06-21T11:37:01-07:00
by fmw42
I don't know much about bmp image, but see http://www.imagemagick.org/Usage/formats/#bmp

and also try

convert bmp32bit -background somecolor -flatten bmp24bit

Re: BMP4 to BMP3 - changing alpha from black to white?

Posted: 2009-06-21T12:56:15-07:00
by Steve
Hi,

From the file format reference it's clear that IM is no fan of bmp file formats.

Fortunately I also have my reference image as a .png. I can convert this
to BMP3 and BMP4 without problem:

BMP3 on white background:

convert -size 256x256 xc:white infile.png -composite BMP3:outfile.bmp

BMP4 with alpha channel:

convert infile.png outfile.bmp

I'm sure there are better ways but I'll stick with this and helpfully keep my sanity.

Thanks, Steve.