Preventing removal of SVG attributes when used on the command line
Hello,
I started to use recently Inkscape through the command line to convert text into outlines.
inkscape cool_drawing_with_text_and_colours.svg --export-text-to-path --export-plain-svg
This conversion is part of a process for converting an SVG into a PDF/X using different technologies.
The output PDF/X needs to have colour information. The colour information can be CMYK or spot colours. The PDF/X library expects certain attributes on the SVG to reflect the exactly same colours in the result PDF/X.
For example, if we want to include CMYK information, the PDF/X library expects
<svg> <rect fill="#FF0000 device-cmyk(1,1,0,0)"/> </svg>
We found that Inkscape removes attributes, so we use icc-color(cmyk, 1, 1, 0, 0) rather than device-cmyk(1,1,0,0) and then after the Inkscape step we translate each icc-color(cmyk, ...) it to device-cmyk(...) attribute.
For using spot colours, the workaround it's a bit more creative. The PDF/X library expects the following SVG
<svg> <rect fill="#FF0000 icc-named-color(profile, 'Cool Red (102))"/> </svg>
The attribute icc-named-color(...) gets stripped away, so we found a workaround using again icc-color(...) too and we do the translations back after. To ensure the values are kept after using Inkscape we use aliases and then we translate the aliases back. With no aliases not every named color will stay on the result SVG after Inkscape. For example:
<svg>
<rect fill="#FF0000 icc-color(spot-1)"/>
</svg>
And after we will translate icc-color(spot-1) to icc-named-color(profile, 'Cool Red (102))
I didn't find any other attribute except *icc-color* to work on this workaround, is there a list of svg attributes that are accepted by Inkscape parsing?
Is there a way of preventing any of these attributes to be removed, any options on the command line that I've missed? It removes several attributes not only the ones mentioned above.
I attached an example of the SVG that I'm trying to process with Inkscape, in case that helps.
Thank you very much, any help or suggestions will be welcome! -- *Pilar Sopena Suils* Senior Backend Engineer
Office: +44(0)20 39716787 <%2B44%280%2920%203701%207639>
Unmade, 28A Easton Street, London, WC1X 0DS Registered UK business no. 08498078
www.unmade.com
Hi Pilar,
This looks like an issue rather than a docs discussion, can you report it here please:
https://gitlab.com/inkscape/extensions/issues
Best Regards, Martin Owens
On Mon, 2020-06-01 at 08:59 +0100, Pilar Sopena wrote:
Hello, I started to use recently Inkscape through the command line to convert text into outlines.
inkscape cool_drawing_with_text_and_colours.svg --export-text-to- path --export-plain-svg
This conversion is part of a process for converting an SVG into a PDF/X using different technologies. The output PDF/X needs to have colour information. The colour information can be CMYK or spot colours. The PDF/X library expects certain attributes on the SVG to reflect the exactly same colours in the result PDF/X. For example, if we want to include CMYK information, the PDF/X library expects
<svg> <rect fill="#FF0000 device-cmyk(1,1,0,0)"/> </svg>
We found that Inkscape removes attributes, so we use icc-color(cmyk, 1, 1, 0, 0) rather than device-cmyk(1,1,0,0) and then after the Inkscape step we translate each icc-color(cmyk, ...) it to device- cmyk(...) attribute. For using spot colours, the workaround it's a bit more creative. The PDF/X library expects the following SVG
<svg> <rect fill="#FF0000 icc-named-color(profile, 'Cool Red (102))"/> </svg>
The attribute icc-named-color(...) gets stripped away, so we found a workaround using again icc-color(...) too and we do the translations back after. To ensure the values are kept after using Inkscape we use aliases and then we translate the aliases back. With no aliases not every named color will stay on the result SVG after Inkscape. For example:
<svg> <rect fill="#FF0000 icc-color(spot-1)"/> </svg>
And after we will translate icc-color(spot-1) to icc-named- color(profile, 'Cool Red (102))
I didn't find any other attribute except icc-color to work on this workaround, is there a list of svg attributes that are accepted by Inkscape parsing? Is there a way of preventing any of these attributes to be removed, any options on the command line that I've missed? It removes several attributes not only the ones mentioned above. I attached an example of the SVG that I'm trying to process with Inkscape, in case that helps. Thank you very much, any help or suggestions will be welcome! -- Pilar Sopena Suils Senior Backend Engineer
Office: +44(0)20 39716787
Unmade, 28A Easton Street, London, WC1X 0DS Registered UK business no. 08498078
www.unmade.com _______________________________________________ Inkscape Docs mailing list -- inkscape-docs@lists.inkscape.org To unsubscribe send an email to inkscape-docs-leave@lists.inkscape.org
participants (2)
-
doctormo@gmail.com
-
Pilar Sopena