xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: How can I change the color model of an SVG image from RGB to CMYK and vice versa?
Date Mon, 20 Dec 2010 08:33:57 GMT
On 19.12.2010 18:10:42 Martin Jacobson wrote:
> I'm going to join this thread because I have an application that
> produces SVG maps that are ultimately printed to a vitreous enamel
> panel that forms part of a street sign. The app has to work in RGB
> because SVG only understands RGB, but the graphic design specification

/s/only understands RGB/always requires a fallback sRGB value

SVG does support non-RGB colors. But currently, Batik doesn't support
passing on non-sRGB colors (they are converted to sRGB). I've added
support for that this summer in development branches [1] which I'm in
the process of getting ready to merge back into the respective trunks.

> defines all colours as precise CMYK values. These CMYK values were
> arrived at by experimentation with the printer, and cannot be
> compromised.
> As you know, most RGB values map to a range of CMYK values, depending
> mostly on the amount of black (K), so there isn't a nice 1 to 1
> relationship between RGB & CMYK. Is there a simple, and foolproof way
> of doing the conversion? Our method at the moment is a horrendous hack
> that I would blush to describe!

No, there is no foolproof way for such a conversion. Color conversions
have the habit of being lossy. In your case, I believe there are two
possible ways:

1. if you can get hold of the ICC output color profile for your printer,
you can specify your carefully determined CMYK values with the
icc-color() function [2] and the color-profile element [3].

2. you can use the new functions specified in the SVG Color 1.2 working
draft to specify device-specific CMYK colors (device-cmyk() function [4]).
I've implemented this in the color branches but this is work in progress
on the side of the specification so this can still change.

But in both cases, you need the code from the color branches to have the
colors make it into the PDF "as is".

[1] http://wiki.apache.org/xmlgraphics/ColorHandling
[2] http://www.w3.org/TR/SVG11/types.html#DataTypeICCColor
[3] http://www.w3.org/TR/SVG11/color.html#ColorProfileElement
[4] http://www.w3.org/TR/SVGColor12/#device

> thanks
> Martin

Jeremias Maerki

To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message