Page 1 of 1
Bug for ImageMagick to import SVG image
Posted: 2013-06-02T04:03:53-07:00
by dengshenyu
Hi IM devel members,
I have trouble when using ImageMagick to deal with SVG image. Here's the SVG image,
Code: Select all
<?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" 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' to get this image info, I was told "Geometry: 1x1+0+0". Why would this happen? Should I specify the 'width' and 'height' for svg tag?
Re: Bug for ImageMagick to import SVG image
Posted: 2013-06-02T05:29:02-07:00
by snibgo
After copying your example into grad.svg, for IM 6.8.5-8 on Windows 7, I get the expected 100x100:
Code: Select all
D:\web\im>%IM%identify grad.svg
grad.svg SVG 100x100 100x100+0+0 16-bit sRGB 478B 0.031u 0:00.021
D:\web\im>%IM%convert grad.svg g.png
D:\web\im>%IM%identify g.png
g.png PNG 100x100 100x100+0+0 16-bit sRGB 597B 0.000u 0:00.000
Re: Bug for ImageMagick to import SVG image
Posted: 2013-06-02T06:11:46-07:00
by dengshenyu
snibgo wrote:After copying your example into grad.svg, for IM 6.8.5-8 on Windows 7, I get the expected 100x100:
Code: Select all
D:\web\im>%IM%identify grad.svg
grad.svg SVG 100x100 100x100+0+0 16-bit sRGB 478B 0.031u 0:00.021
D:\web\im>%IM%convert grad.svg g.png
D:\web\im>%IM%identify g.png
g.png PNG 100x100 100x100+0+0 16-bit sRGB 597B 0.000u 0:00.000
My IM is 6.5.4, and want to know why would this happen. Is it the librsvg library not working or something else?
Re: Bug for ImageMagick to import SVG image
Posted: 2013-06-02T06:49:10-07:00
by snibgo
The oldest IM I have is 6.5.8-8, which gives me the same results as 6.8.5-8. But it might use a different delegate to your setup. I'm not an expert at IM configuration with libraries etc etc.
Inkscape is generally more comprehensive than IM at reading SVG files.
Re: Bug for ImageMagick to import SVG image
Posted: 2013-06-02T08:28:21-07:00
by dengshenyu
snibgo wrote:The oldest IM I have is 6.5.8-8, which gives me the same results as 6.8.5-8. But it might use a different delegate to your setup. I'm not an expert at IM configuration with libraries etc etc.
Inkscape is generally more comprehensive than IM at reading SVG files.
Thanks for infomation, but I need to figure out why would this happen.
Re: Bug for ImageMagick to import SVG image
Posted: 2013-06-02T11:02:15-07:00
by fmw42
IM can use its internal MSVG or the external delegate for RSVG or I believe Inkscape. But I do not know how one would install or get an Inkscape delegate or program.
If you run
convert -format
and look at the line for SVG it should tell which it is using.
From
http://www.imagemagick.org/script/formats.php
SVG RW Scalable Vector Graphics ImageMagick utilizes inkscape if its in your execution path otherwise RSVG. If neither are available, ImageMagick reverts to its internal SVG renderer. The default resolution is 90dpi.
There is a link to Inkscape in the comment on the page.
Re: Bug for ImageMagick to import SVG image
Posted: 2013-06-02T11:12:06-07:00
by snibgo
fmw42 wrote:ImageMagick utilizes inkscape if its in your execution path...
Ah, I didn't know that. Just tested it, and it works! Thanks.
On installing Inkscape: for Windows, I just download and install from
http://inkscape.org/download/?lang=en