Shenyuan Deng
Shenyuan Deng

Reputation: 1

ImageMagick reading SVG with unexpected result

I have a question about IM reading SVG Images and it really troubles me. For the SVG image below,

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg"  version="1.1" width="100%" height="100%" viewBox="0 0 100 100">
  <defs>
    <linearGradient id="grad1">
      <stop offset="0%" stop-color="white"/>
      <stop offset="100%" stop-color="black"/>
    </linearGradient>
  </defs>
  <rect x="10" y="10" width="80" height="80" fill="url(#grad1)" stroke="blue"/>
</svg>

When I use identify -verbose sample.svg, I got the result with "Geometry: 1x1+0+0". But other people get "Geometry: 100x100+0+0". And seems 100x100 is correct. Why would this happen?

Upvotes: 0

Views: 264

Answers (1)

dev4life
dev4life

Reputation: 11394

During my own experiments I have noticed that Imagick's default SVG delegate has problems handling SVGs that contain:

fill="url(#grad_or_imagepattern)"

As far as I am concerned, and explained here: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=23525, Imagick "can use its internal MSVG or the external delegate for RSVG or I believe Inkscape" if available.

I recommend you do the following in order: 1. uninstall Imagick 2. install Inscape 3. add Inscape directory to system path 4. install Imagick

In this way, Imagick will be able to ask Inscape to do the conversion. All the best,

Upvotes: 1

Related Questions