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?
8bpp BMP files
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: 8bpp BMP files
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
do you need the alpha channel? if not try
convert inputimage.bmp -alpha off -depth 8 -type grayscale resultimage.bmp
Re: 8bpp BMP files
-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.
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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: 8bpp BMP files
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.
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
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
Did you ever figure this out?
Using ImageMagick 6.7.2-9 2011-09-23 Q16
Re: 8bpp BMP files
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.
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.