# How to export CMYK in eps?

If I create a figure using the CMYK color space, it views on screen as RGB. It also exports as RGB. I want an eps file, but I also tried pdf and jpg. Example:

p = Graphics[{CMYKColor[1, 0, 1, 0], Rectangle[]}]
Export["testp.eps",p]


If you look in the eps file, you find the line

0 0.999985 0 rg


where earlier rg has been defined as

/rg { setrgbcolor } bind def


If the line were changed to

1 0 1 0 setcmykcolor


then it would be correct.

How do I get it to export as CMYK?

EDIT

Export can take the option ColorSpace.

That is, the following code would export the graphic in CMYK.

Export["cmyk.eps", p, "EPS", ColorSpace -> "CMYK"]


I see these lines in the EPS file, so I believe the above code works:

/k{setcmykcolor}bind def
...
1 0 1 0 k

• When I export to eps, the file has the line /DeviceRGB setcolorspace. The actual image is in binary, so I don't know what's there, but when displayed on screen, it is clearly not CMYK (it is not in that gamut). I'd also really prefer vector graphics than raster, but I can accept raster if needed. (I too cannot Import eps.) – Russ Lyons Aug 4 '16 at 3:13
• BTW, the jpg that is exported from cmyk turns out to be a black square, which is incorrect. It should be green. Exporting jpg from rgb gives the correct color. – Russ Lyons Aug 4 '16 at 3:20
• Fixed my answer. Does that work? – JungHwan Min Aug 4 '16 at 5:03
• Also, about the jpg being black, I believe that's a flaw inside Mathematica. I opened a new question (123123). – JungHwan Min Aug 4 '16 at 5:17
• I can confirm the above code works. @RussLyons if you wanted to work with raster you should put that in the question, eps handling of vector and raster is different. You should also be aware the color space needs to be handled properly by your postscript interpreter. – george2079 Aug 4 '16 at 14:20

Wolfram Research has confirmed that this is an error (at least with Ubuntu 14.04 LTS and Mathematica 10.4): it does not work to say Export["cmyk.eps", p, "EPS", ColorSpace -> "CMYK"].