Search code examples
jpegimagemagick-convertepscmyk

jpg to eps conversion inverts colors


I'm trying to convert some CMYK images from jpg to eps using convert image.jpg -format esp3 image.eps. The resulting file appears to invert or mangle the color information.

Sample of the original .jpg:

enter image description here

Sample of the converted .eps:

enter image description here

I've tried some variations of the command. The output of convert -colorspace RGB image.jpg -format esp3 image.eps, for example, looks significantly better (as in the image is identifiable). Predictably, however, the colors are not correct.

What can I do to correct the outcome? I'm open to other (linux terminal) programs or scripting languages to get the job done.

Potentially useful information:

$ convert --version
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib

Solution

  • This works fine for me on IM 6.9.10.84 Q16 Mac OSX.

    sRGB lena.jpg:

    enter image description here

    Convert it to CMYK:

    convert lena.jpg -colorspace CMYK x1.jpg
    


    CMYK lena (x1.jpg):

    enter image description here

    Convert to EPS:

    convert x1.jpg EPS3:x1.eps
    

    A display of x1.eps using Mac Preview looks fine - no color inversion.

    Likewise, using profiles is even better:

    convert lena.jpg -profile /Users/fred/images/profiles/sRGB.icc -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc x2.jpg
    


    CMYK lena with profiles (x2.jpg)

    enter image description here

    Convert to EPS:

    convert x2.jpg EPS3:x2.eps
    


    Result looks like the jpg from which it was created -- no color inversion.

    Post your input jpg and I can take a look.

    Perhaps it is your version of ImageMagick or of libjpeg or of lcms?

    convert image.jpg -format esp3 image.eps

    Note: you have misspelled -format eps3 (you used esp3). So perhaps the default EPS does not support what you are trying to do. Also note I prefaced my output with EPS:. Try that, though probably won't matter.