7
$\begingroup$

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?

$\endgroup$
3
$\begingroup$

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
$\endgroup$
  • $\begingroup$ 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.) $\endgroup$ – Russ Lyons Aug 4 '16 at 3:13
  • 2
    $\begingroup$ 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. $\endgroup$ – Russ Lyons Aug 4 '16 at 3:20
  • $\begingroup$ Fixed my answer. Does that work? $\endgroup$ – JungHwan Min Aug 4 '16 at 5:03
  • $\begingroup$ Also, about the jpg being black, I believe that's a flaw inside Mathematica. I opened a new question (123123). $\endgroup$ – JungHwan Min Aug 4 '16 at 5:17
  • $\begingroup$ 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. $\endgroup$ – george2079 Aug 4 '16 at 14:20
3
$\begingroup$

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"].

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.