Page 1 of 1

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

Posted: 2009-04-09T21:44:29-07:00
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

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

Posted: 2009-04-10T06:25:56-07:00
by magick
Have you tried adding -colors 256 to your command line?

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

Posted: 2009-04-10T07:37:42-07:00
by jun
Yes I did, and it did not work in that all three RGB channels are still there.

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

Posted: 2009-04-10T08:22:08-07:00
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