Skip to main content
Participating Frequently
April 14, 2014
Question

How can I export an SVG with both RGB and CMYK colors?

  • April 14, 2014
  • 2 replies
  • 34872 views

I'm trying to make a workflow for Illustrator (CMYK) to Web (SVG with CMYK colors and RGB fallbacks) to Print (CMYK PDF) using SVG. However, it looks like Illustrator only exports RGB colors in SVG files. Illustrator would only be responsible for the saving as SVG, then I'd use other tools to do the rest.

Is there a way to get Illustrator to export device-cmyk() or icc-color() values in addition to RGB colors in an SVG file? Is there a way to export spot color names as well?

Thanks!

This topic has been closed for replies.

2 replies

Mylenium
Legend
April 14, 2014

Alternate color models will be supported in SVG 2, but since it is an unfinished draft at the moment nobody really uses it and so does AI. You want something that doesn't exist, though I'm sure some preliminary implementations exist e.g. in some development branch of Inkscape. Eitehr way, at this point it's totally pointless to waste a second thought on this. Unless it becomes an official standard, Adobe won't support it in their apps. For now you can only create your own implementation with custom user data sections and referenced color profiles. Beyond that you have things backwards - nobody and really nobody on teh web cares for CMYK. Even if the spec were already final, anyone with brains would still convert the colors on the local calibrated system to a) ensure correct color rendering and b) keep file sizes as small as possible. Even if browsers may support it, they wil lonly use generic profiles to render CMYK or Lab. Yor idea is seriously flawed therefore. What you want would be like having a custom high-gammut profile in AI and then using a standard FOGRA profile for printing - the colros will simply be wrong.

Mylenium

jon__wuAuthor
Participating Frequently
April 14, 2014

Hi Mylenium,

Thanks for the feedback. You're right that unmanaged device colors, device-cmyk() doesn't appear until SVG2 (http://www.w3.org/TR/SVG2/color.html#device). Sorry if that was misleading. My other example however, icc-color(), is part of SVG 1.1 but the SVG 1.2 docs are a litte more detailed (http://www.w3.org/TR/SVGColor12/#icc-colors). I agree, that Adobe wouldn't necessarily support a draft specification, but there exist some ways to do this within SVG 1.1. Here's a quote about icc-colors from that last link:

As with SVG Full 1.1, SVG Color content may specify color using an ICC profile (see [ICC42]); an sRGB fallback must still be provided.

As for the intent, let me clairfy. I'd want to use an RGB fallback for display on the web since RGB is used by monitors of course. However, I will eventually convert the resulting SVG to a PDF for print and in that case I'll need the CMYK values since it's impossible convert from CMYK to RGB and back to CMYK. The reason I can't export straight to PDF in the first place is that I'll allow users to manipulate the SVG in their browser before printing.

Let's sssume I have all the other details worked out such as how to force the browser to ignore the icc-color so it always uses the fallback for consistency; I still need to figure out how to maintain the CMYK colors or get a mapping of RGB to CMYK colors for all colors in the document. I'm thinking that creating a mapping for each document might be the solution here, but I'm still brainstorming the best way to do that as well.

Any other ideas?

Thank you

jon__wuAuthor
Participating Frequently
August 26, 2014

hi, ok, do you have some binaries for this branch of batik-rasterizer, you could share?


Download the svgcolor12 branch source and use the all-jar ant target. The

other targets won't work. See the last post here:

http://batik.2283329.n4.nabble.com/How-can-I-change-the-color-model-of-an-SVG-image-from-RGB-to-CMYK-and-vice-versa-td3092769.html

.

Monika Gause
Community Expert
Community Expert
April 14, 2014

Is there a way to get Illustrator to export device-cmyk() or icc-color() values in addition to RGB colors in an SVG file?

SVG files store HEX color values.

jon__wuAuthor
Participating Frequently
April 14, 2014

Hi Monika,

The hex values are RGB colors. I'm looking for a way to get CMYK colors exported in addition to the RGB colors so that I can get the print colors correct when converting my SVG back to PDF later in my workflow.

Here's an example:

<color-profile name="acmecmyk" xlink:href="http://printers.example.com/acmecorp/model1234"/>

<circle fill="#CD853F icc-color(acmecmyk, 0.11, 0.48, 0.83, 0.00)"/>

See http://www.w3.org/TR/SVGColor12/#icc-colors for more info on icc-color(). device-cmyk() is another possibility.

I suspect that Illustrator may not support either of these but I wanted to verify. If it doesn't, any ideas for other workarounds? The assumption is that Illustrator will not be involved after the file is exported to SVG which is why it's important to get the CMYK equivalents exported with the RGB colors during the initial export to SVG.