Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated SVG incompatible with ImageMagick (not standards-compliant?) #395

Open
divilian opened this issue May 14, 2020 · 7 comments
Open

Comments

@divilian
Copy link

When I take any .svg file produced by the SVG() function, and try to run the ImageMagick "convert" utility on it (to, say, convert it to a frame of what will become an animated GIF), I get these errors:

shell> convert tomato.svg tomato.gif
convert-im6.q16: unrecognized color `context-stroke' @ warning/color.c/GetColorCompliance/1052.
convert-im6.q16: unable to open image `context-stroke': No such file or directory @ error/blob.c/OpenBlob/2701.
convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504.
convert-im6.q16: non-conforming drawing primitive definition `stroke' @ error/draw.c/DrawImage/3265.

(The code I used to produce tomato.svg is:

composition = compose(compose(context(), rectangle()), fill("tomato"))
draw(SVG("tomato.svg", 4cm, 4cm), composition)

i.e., the example directly from the Compose.jl documentation. I'm running Julia 1.4.1 with Compose v0.8.2.)

@Mattriks
Copy link
Member

In Compose context-stroke is used for marker arrows, and markers are defined at the top of the svg file (whether you use them or not). You could manually edit the svg file, or perhaps ask at ImageMagick issues if it's a bug, or on their To Do list, or they have a workaround. That would help us to decide our way forward.

@bjarthur
Copy link
Member

does your example output pass an SVG validator?

@divilian
Copy link
Author

@Mattriks
Copy link
Member

You can't test an svg v1.2 file (tomato.svg) using an svg 1.1 validator. This validator will pass for svg 1.2:
https://validator.nu/?doc=http%3A%2F%2Fstephendavies.org%2Ftomato.svg.
Green box at the bottom says "the document validates according to the specified schema" (i.e. schema =v1.2). The warning in yellow can be ignored.

@divilian
Copy link
Author

ah, got it. Thanks @Mattriks. So if I understand what I'm reading then, this demonstrates that the issue is actually with ImageMagick, not Compose.jl. (Somebody tell me if I'm misinterpreting! New to all this.)

@Mattriks
Copy link
Member

Mattriks commented May 19, 2020

context-fill and context-stroke are available in svg 1.2 (i.e. leading up to svg 2). Inkscape supports these features (https://inkscape.org/release/inkscape-0.92/ - scroll down to near the bottom of that page - under the header "SVG and CSS"), and so does Compose. But many web browsers still only support svg 1.1. So the question is: does ImageMagick support svg 1.2, or is it on their To Do list?

Note: Apparently ImageMagick will use Inkscape if it's available, see e.g. ImageMagick/ImageMagick#1880

@Mattriks
Copy link
Member

Did you investigate converting a Compose svg file using ImageMagick with Inkscape? If so, please write about your findings here, to help other users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants