[SOLVED] SVG convert troubles - where's the problem?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
toolforger
Posts: 18
Joined: 2015-09-28T00:39:38-07:00
Authentication code: 1151

[SOLVED] SVG convert troubles - where's the problem?

Post by toolforger »

Hi all,

I have a handmade SVG that displays just fine in Firefox and Gimp, but convert just doesn't grok it. Am I doing something wrong in my SVG, or did I hit an ImageMagick limitation or bug?

Full details:

penrose-triangle.svg source:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   version="1.0"
   width="163.00"
   height="141.31">
  <!-- width := maxX - minX + strokewidth -->
  <!-- height like width                  -->
  <defs>
    <!-- The Penrose triangle consists of three copies of a "hook" shape, -->
    <!-- rotated by 120 and 240 degrees.                                  -->
    <!-- Define the "bottom" shape here, assuming that it "wraps itself   -->
    <!-- around the origin":                                              -->
    <path id="hook"
      d="M -70.00,+51.96 L +70.00,+51.96 L +80.00,+34.64 L -40.00,+34.64 L +00.00,-34.64 L -10.00,-51.96 z"
      style="stroke:#000000;stroke-width:3;stroke-linejoin:round"
      />
  </defs>
  <!-- translateX = -minX + strokewidth/2 -->
  <!-- translateY like translateX         -->
  <g transform="translate(81.50,87.85)">
    <use xlink:href="#hook" style="fill:#333333" />
    <use xlink:href="#hook" style="fill:#cccccc" transform="rotate(+120)" />
    <use xlink:href="#hook" style="fill:#ffffff" transform="rotate(-120)" />
  </g>
</svg>
The stripped-to-triviality "convert" command line that reproduces the problem:

Code: Select all

convert penrose-triangle.svg penrose-triangle.png
Result:
Image

Version information (this is what you get on 15.04):

Code: Select all

$ convert --version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2015-01-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
Last edited by toolforger on 2015-09-28T09:14:03-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: SVG convert troubles - where's the problem?

Post by snibgo »

IM reads SVG files either with built-in MSVG, or built-in delegate RSVG, or external delegate Inkscape.

With MSVG I get the same result as you. With RSVG and Inkscape I get correct results.

Inkscape is the most capable of the three. I suggest you install it. IM should then use it.
snibgo's IM pages: im.snibgo.com
toolforger
Posts: 18
Joined: 2015-09-28T00:39:38-07:00
Authentication code: 1151

Re: SVG convert troubles - where's the problem?

Post by toolforger »

Ah, now I remember - I had that issue before, had inkscape installed, but forgot to install that again on OS reinstall.
Thanks!
Post Reply