problem: converting 16bit TIF to 8bit Grayscale

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
jun

problem: converting 16bit TIF to 8bit Grayscale

Post by jun »

Hello,
I am in an unfortunate situation of having 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 6.3.3 saves BMP only in RGB mode even with -colorspace Gray and/or -type Grayscale and/or -colors 256 options specified, resulting in 3x larger file size than desired (because of the three redundant channels R=G=B=256 grayscale).

In general, what is the right way of converting 16bit TIF to 8bit BMP with a single-channel grayscale?
Thanks,
Jun

(sorry, i posted this message in a wrong forum previously)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: problem: converting 16bit TIF to 8bit Grayscale

Post by fmw42 »

try

convert image16.tif -depth 8 -colors 256 -type grayscale image8.bmp

also see

http://www.imagemagick.org/Usage/formats/#bmp

you may need to add

convert image16.tif -depth 8 -colors 256 -type grayscale BMP3:image8.bmp


You can also try:

convert image16.tif -depth 8 -quantize gray -colors 256 +dither image8.bmp

see
http://www.imagemagick.org/Usage/quantize/#quantize
Post Reply