ImageMagick Reduces Colorspace to Gray

grayscaleimagemagickrgb

I convert RGB and CMYK TIFF images to RGB JPEGs using

convert a.tif -colorspace rgb a.jpg

If the TIFF image contains only gray pixels, the colorspace of the resulting JPEG is gray, not RGB.

How can I force ImageMagick to always use RGB?

Best Answer

Try this:

convert a.tif -colorspace rgb -type truecolor a.jpg

However, I have to ask: How exactly do you determine your verdict 'colorspace of resulting JPEG is gray, not RGB'?!?

The ImageMagick tool identify can look at the colorspace used by files. If you have convert, then you'll have identify too:

identify -format "%[colorspace]   <== %f\n"  *.png *.jpeg *.pdf *.tif

Example output:

 sRGB   <== fullsize-coalesce-originals.png
 Gray   <== tiffg4.tif
 CMYK   <== cmyk.pdf
 CMYK   <== photoshop.jpeg
Related Topic