Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImageMagick Reduces Colorspace to Gray

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?

like image 209
Christoph Walesch Avatar asked Jul 12 '12 01:07

Christoph Walesch


1 Answers

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
like image 126
Kurt Pfeifle Avatar answered Oct 10 '22 09:10

Kurt Pfeifle