Note that there are some explanatory texts on larger screens.

plurals
  1. POSVG to PNG Conversion with ImageMagick doesn't handle defs?
    text
    copied!<p>The answer is on the answer I flagged, but is in the comments. Basically, see here: <a href="http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&amp;t=18816" rel="nofollow noreferrer">http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&amp;t=18816</a></p> <p>Run this on Mac with Ports:</p> <pre><code>sudo port install ImageMagick +rsvg </code></pre> <p>Here's my original Question:</p> <p>My test.svg file is here: <a href="https://gist.github.com/2727243" rel="nofollow noreferrer">https://gist.github.com/2727243</a></p> <p>Imagemagick version: ImageMagick 6.7.6-9 2012-05-18 Q16 (just updated today)</p> <p>I have a SVG file the does a defs -> symbol to define an arrow symbol. Later on in the document I xlink:use that symbol. This works fine in Chrome and the arrow comes up and is in its proper position:</p> <p><img src="https://i.stack.imgur.com/00OJI.png" alt="enter image description here"></p> <p>However, if I convert the image via imagemagick like so:</p> <pre><code>convert test.svg test.png </code></pre> <p>It doesn't work. Here's what I get:</p> <p><img src="https://i.stack.imgur.com/qAad4.png" alt="enter image description here"></p> <p>The "use" appears to be ignored completely, and instead the arrow is rendering at the def. At least, near as I can tell.</p> <p>Am I formatting my SVG wrong for Imagemagick to handle this scenario? Or is this just something that Imagemagick doesn't support properly? I've been looking all over for a definitive answer and can't find one, one way or the other.</p> <p>I also tried the SVG here: <a href="http://www.carto.net/svg/samples/symbol.svg" rel="nofollow noreferrer">http://www.carto.net/svg/samples/symbol.svg</a> and the symbols did NOT work. So I'm leaning toward Imagemagick being the culprit.</p> <p>UPDATE: I tried changing the def to the following:</p> <pre><code>&lt;symbol id="arrow" x="25"&gt; </code></pre> <p>In the browser, the arrow DOES move 25 to the right, but in Imagemagick it sticks to (0,0). This was leading me to believe that it's less about the symbol definition and more about it not translating it properly. However, even if I try a straight transform on the "use" and, even better, remove the "use" entirely, the arrow still appears.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload