8bpp BMP files

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
cheesey
Posts: 2
Joined: 2011-06-20T03:10:54-07:00
Authentication code: 8675308

8bpp BMP files

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 8bpp BMP files

Post 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
cheesey
Posts: 2
Joined: 2011-06-20T03:10:54-07:00
Authentication code: 8675308

Re: 8bpp BMP files

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 8bpp BMP files

Post 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.
Chipper
Posts: 2
Joined: 2011-10-05T07:29:35-07:00
Authentication code: 8675308

Re: 8bpp BMP files

Post 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
Chipper
Posts: 2
Joined: 2011-10-05T07:29:35-07:00
Authentication code: 8675308

Re: 8bpp BMP files

Post 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.
Post Reply