Page 1 of 1
8bpp BMP files
Posted: 2011-06-20T05:49:54-07:00
by cheesey
Hello,
Situation: I have a 32-bit BMP file, which (for long and unpleasant reasons) is monochrome. I am attempting to convert this into an 8-bit BMP. (It needs to be 8-bit, even though it is monochrome; I'm interacting with something with a hideously broken image loader. Fixing said image loader is not *really* an option).
Doing this:
convert in.bmp -type palette -depth 8 foo/out.bmp
Always gives me a 2bpp bitmap (according to a hex editor). I've tried adding -colors 256 to it, as well.
What am I doing wrong?
Re: 8bpp BMP files
Posted: 2011-06-20T08:55:31-07:00
by fmw42
what is your version of IM?
do you need the alpha channel? if not try
convert inputimage.bmp -alpha off -depth 8 -type grayscale resultimage.bmp
Re: 8bpp BMP files
Posted: 2011-06-21T03:22:41-07:00
by cheesey
-type grayscale doesn't work here. -alpha off makes no difference at all. There is no alpha information in the BMP, so the entire channel can be thrown away if need be.
I've reproduced on:
Version: ImageMagick 6.5.7-8 2009-11-26 Q16
http://www.imagemagick.org
Version: ImageMagick 6.6.1-3 2010-04-16 Q16
http://www.imagemagick.org
The debian package imagemagick 8:6.6.0.4-3
Which were the ones in package management on the machines I happen to have kicking around here at the moment.
Re: 8bpp BMP files
Posted: 2011-06-21T10:21:23-07:00
by fmw42
Perhaps I misunderstand. Is this a 32-bit single channel image or an 8-bit per channel with 4 channels rgba?
Perhaps it would be best if you post a link to your image (or a small subsection of it), so others can test with it.
IM may recognize it is binary and ignore the -type grayscale and keep it binary.
Re: 8bpp BMP files
Posted: 2011-10-05T07:38:21-07:00
by Chipper
I am trying to force IM to create 4BPP and 8BPP bmp files too and all I can get is 24BPP files.
Did you ever figure this out?
Using ImageMagick 6.7.2-9 2011-09-23 Q16
Re: 8bpp BMP files
Posted: 2011-10-05T07:47:15-07:00
by Chipper
Posted too soon.... this did the trick...
example:
convert -size 800x480 gradient:green-yellow -depth 8 -alpha off -compress NONE -colors 256 BMP3:gr_green-yellow.bmp
Not sure if I needed all the options... but it worked.