0
votes

i have a problem with the imagemagick convert command. The command works perfect with normal .svg with a standard structure.

But if you use the <defs> area and a <use xlink:href..> reference it doesn't work.

magick convert test.svg -resize 50% test.png

  • works on SVG1
  • doesn't work on SVG2 with xlink:href

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 29000 17000">
    <circle cx="5000" cy="5000" r="3000" stroke="black" stroke-width="300" fill="green"/>
    </svg>


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 29000 17000">
    <title>CB0F5BA4Title</title>
    <defs>
    <symbol id="CB0F5BA4">
    <g>
    <circle cx="5000" cy="5000" r="3000" stroke="black" stroke-width="300" fill="green"/>
    </g>
    </symbol>
    </defs>
    <svg>
    <use xlink:href="#CB0F5BA4"/>
    </svg>
    </svg>

Does anybody can help and give me an idea, what's wrong?
SVG is correct shown in Safari (Browsers) and checked by XML-Oxygen App
OS is macOS 10.13.6

Version: ImageMagick 7.0.8-20 Q16 x86_64 2018-12-26
https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jp2 jpeg lcms ltdl lzma png tiff webp xml zlib

magick convert -list format

Format Module Mode Description

  SVG  SVG       rw+   Scalable Vector Graphics (XML 2.9.4)
 SVGZ  SVG       rw+   CompressedScalableVectorGraphics (XML 2.9.4)
1

1 Answers

0
votes

Your second file is huge when rasterized with the default density. But it works fine for me on Imagemagick 7.0.8.25 Q16 Mac OSX using Inkscape when I use a small density to render it. You are using the Imagemagick XML/MSVG internal renderer, which is the least functional. If you install Inkscape on your system, Imagemagick will use that automatically. Otherwise, install RSVG delegate with Imagemagick and try that. Also use magick with IM 7 and not magick convert.

magick identify test.svg test4.svg SVG 29000x17000 29000x17000+0+0
8-bit sRGB 2.12389MiB 0.000u 0:00.000

magick -density 16 test4.svg -resize 50% test4.png


enter image description here