Page 1 of 1

Converting XPM to BMP

Posted: 2018-02-15T17:02:26-07:00
by tonyo
OK, so I have an XPM file that is about 23x39 pixels, or about 7.3kb in size.
I want to convert this to a 64x96 pixel BMP file, using 256 colors per pixel.

So I try

magick image.xpm -resize 64x96 -colors 256 BMP2:image.bmp

The BMP file is now 18kb, and the bit depth is 24, not good.

If I use AhaView to convert to 8bpp BMP, the file goes down to approx. 7kb. much better.

I suspect that IM is turning the 8-bit palette plus 8 bits/pixel XPM file into a no-palette and three bytes/pixel BMP file.

What incantation do I use to get IM to make an 8bpp BMP file?

I need the smaller file for an embedded application (not much memory) and do not have a fancy embedded BMP reader that can decompress encoded BMP files.

Re: Converting XPM to BMP

Posted: 2018-02-15T17:42:19-07:00
by fmw42
try

magick image.xpm -resize 64x96 +dither -colors 256 -depth 8 -type palette BMP2:image.bmp

Re: Converting XPM to BMP

Posted: 2018-02-16T10:49:30-07:00
by tonyo
Amazing. Worked perfectly.

Take the rest of the day off. Tell them some guy on the internet said it was OK!

thanks again,

tony o.