[Tex/LaTex] How to make sure images are CMYK


I am submitting a paper to a conference in a few days and just noticed they require all images to be in CMYK color space. Is there a quick easy way to check if they are?

And if they are not, is there a quick easy way to convert them to CMYK, preferably via PDFlatex or another Latex component (best) or via a batch utility (good) or something so I don't have to do it manually (bad). If a batch is the solution, I'd like to be able to take a copy of my working folder tree, point a batch utility at it, and have it convert everything therein to CMYK if it's not already.

My images are mostly jpeg, but I think I might have some PNGs as well.

Best Answer

PNG's cannot be in the CMYK colorspace, so if you have some you will need to convert them to JPGs.

I only use linux so my solution may not be relevant but imagemagick is a good commandline tool to batch convert images.

if you use colour within your document you will need to load the xcolor package with the cmyk option to make sure that all colour definitions are translated to the CMYK colorspace (although it will not convert included images, only colours of used directly in the latex document.

One other note if you use fontspec, for font definitions, using the [Color=...] options as fontspec doesn't support CMYK colours. instead you will need to use the \color{} command from xcolor instead.

An example of imagemagick commandline conversion would be:

convert image-rgb.jpg -colorspace CMYK image-cmyk.jpg

You have to be aware that that the converted image will look different to the original one.

You can check what colorspace the image is encoded in by using the identify command:

identify -verbose image.jpg

and look for the Colorspace: field. In a POSIX environment with grep available simply doing

identify -verbose image.jpg | grep "Colorspace:"

should give you the answer.

Edit: As noticed, the default conversion done by IM via the -colorspace option is not very good. The IM manual advise to use the -profile <filename>.icc option instead to get better results. This requires having the appropriate icc profile file available.

On a linux distribution with ghostscript installed, there is a default_cmyk.icc file which gives already a much better result than the one obtained using the -colorspace CMYK option. However, Adobe make their ICC profiles availble for free, and these can be used by IM to produce even better results. The Adobe ICC profiles are available from the Adobe website. The package comes with 8 RGB profiles and 14 CMYK ones so plenty to choose from. I am tried both the WebCoatedSWOP2006Grade5.icc and the USWebCoatedSWOP.icc, and both give very good results with slight difference between them. However, if the conference insist on CMYK colorspace, it might be worth asking them if they can provide you with their ICC profile, you will therefore make sure that all the colours in your images will print properly.

Once you have the ICC file available, you can then use them with imagemagick like this:

convert image-rgb.jpg -profile "\path\to\cmyk_profile.icc" image-cmyk.jpg 
Related Question