does IM support grayscale BMP? (as opposed to RGB)

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jun

does IM support grayscale BMP? (as opposed to RGB)

Post by jun »

Hello,
I am in an unfortunate situation to convert 16bit grayscale (single channel) TIF to 8bit grayscale BMP. ImageJ does a perfect job for this, but my IM does not (version 6.3.3). More specifically, IM saves BMP only in RGB mode even with -colorspace Gray or -type Grayscale options specified, resulting in 3x larger file size than desired (because of the three redundant channels R=G=B=256 grayscale).

What is the right way of doing this using IM? Or, perhaps IM just does not support single-channel 8bit grayscale BMP?
Thanks,
Jun
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: does IM support grayscale BMP? (as opposed to RGB)

Post by magick »

Have you tried adding -colors 256 to your command line?
jun

Re: does IM support grayscale BMP? (as opposed to RGB)

Post by jun »

Yes I did, and it did not work in that all three RGB channels are still there.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: does IM support grayscale BMP? (as opposed to RGB)

Post by el_supremo »

Try this:

Code: Select all

convert input_image -colorspace gray -quantize gray -depth 8 -colors 256 bmp2:output.bmp
I'm not sure if all those options are needed but the result is an 8-bit grayscale BMP.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Post Reply