On Jul 11, 2012, at 7:55 AM, Adrian Johnson wrote:
> I have been working on an experimental branch of cairo that supports
> color management for the image and pdf surfaces. I'm currently trying to
> get Inkscape to use this API so I can test creating color managed PDF
> files. I'm not familiar with SVG or the Inkscape source and have some
> The SVG specification says that compositing can be performed in sRGB or
> linear RGB color space. I could not find where this is supported in
> Inkscape. For now I've set the PDF surface color space to sRGB.
> What color space are gradients interpolated in? Are all gradient stops
> the same color space? In my patch I have assumed that all stops have the
> same color space and used this color space as the interpolation color space.
> Can a color space be set for an image?
> If anyone is interested the code is here:
> To simplify the implementation only RGB color spaces are currently
Well... we probably have two different areas to consider: display and save/export.
Currently Inkscape works with sRGB for it's rendering and exporting. However, SVG in general allows for arbitrary items to have colors in any specific colorspace, and happily mixes within a single document. And as you mention, SVG itself allows for interpolation in linear RGB, but Inkscape has not supported that yet.
If a color (stroke color, fill color, color on a single stop in a gradient, etc) is more than sRGB it will have the RGB value as fallback and then an icc-color() component that specifies values in a given color profile. So an assumption that all steps in a given gradient may not always be true. I think we would expect at least individual gradients to be consistent, though, even if different gradients in a give work might have different color spaces.
And, yes, individual images can have different color spaces applied.
For common cases, most color managed workflows we see are focused on CMYK or CMYKOG print setups.
A good baseline for checking is to try creating an SVG in Inkscape with at least one CMYK profile attached. Then import that into Scribus (at which point you should check which SVG features Scribus supports so far). Then exporting a color-managed PDF from Scribus should give you a good test case to compare to. Ideally when one has the original color-managed SVG in Inkscape and does an export as PDF, they would get the same result.
Display to screen, on the other hand, can stay flattened to RGB since most display approaches are limited to three colors.