SVG to JPG/PNG with ImageMagick PHP 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
shockwave
Posts: 3
Joined: 2015-12-03T04:57:37-07:00
Authentication code: 1151

SVG to JPG/PNG with ImageMagick PHP problem

Post by shockwave »

Hello,

I'm using ImageMagick with PHP to convert some .svg files to png/jpg and I've a problem with some svgs

Here's the file: https://mega.nz/#!xAdVhDLZ!GzBtP37PPAZf ... qa6R00ShUM

And here's the result of

Code: Select all

convert file.svg file.png
Image

Can someone help me please?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: SVG to JPG/PNG with ImageMagick PHP problem

Post by fmw42 »

I have tried to download your svg file using Firefox, Chrome and Opera (latest versions for Mac) and I keep getting a message that my browser is too old. Try uploading to some other place such as dropbox.com

Also what SVG renderer are you using? In order of preference, Inkscape, RSVG and IM internal MSVG/XML.

type

Code: Select all

convert -list format
and see what you have for SVG


SVG SVG rw+ Scalable Vector Graphics (RSVG 2.40.2)

Also always provide your IM version and platform.
shockwave
Posts: 3
Joined: 2015-12-03T04:57:37-07:00
Authentication code: 1151

Re: SVG to JPG/PNG with ImageMagick PHP problem

Post by shockwave »

Hi fmw42 thanks for the reply!
I have uploaded the svg on dropbox, here's the link: https://www.dropbox.com/s/9vpfwm0zmpakn ... 9.svg?dl=0

And here's the information you asked me
SVG renderer

Code: Select all

SVG  SVG       rw+   Scalable Vector Graphics (RSVG 2.36.1)
System information

Code: Select all

Distributor ID:	Debian
Description:	Debian GNU/Linux 7.1 (wheezy)
Release:	7.1
Codename:	wheezy
IM version

Code: Select all

Version: ImageMagick 6.7.7-10 2012-11-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP 
Should I update my RSVG or use Inkscape?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: SVG to JPG/PNG with ImageMagick PHP problem

Post by fmw42 »

I get your same bad result using IM 6.9.2.7 Q16 Mac OSX with RSVG 2.40.2 and libpng 1.6.12_0. I am not an SVG expert. But you could try upgrading to the very latest of RSVG or install Inkscape and see what happens. Your SVG file displays fine in my browser, though.

Perhaps one of the other IM users or developers could examine your SVG file and see what might be the issue.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: SVG to JPG/PNG with ImageMagick PHP problem

Post by dlemstra »

We just upgraded librsvg to the latest version (2.4.12) in the Windows distribution and we still have this issue. It seems that librsvg does not handle '
' properly. When I remove this from your file I get the correct result. You could report a bug here: https://bugzilla.gnome.org/enter_bug.cg ... ct=librsvg. Please add a link to your bugreport in this post if you decide to report it there.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
shockwave
Posts: 3
Joined: 2015-12-03T04:57:37-07:00
Authentication code: 1151

Re: SVG to JPG/PNG with ImageMagick PHP problem

Post by shockwave »

fmw42 wrote:I get your same bad result using IM 6.9.2.7 Q16 Mac OSX with RSVG 2.40.2 and libpng 1.6.12_0. I am not an SVG expert. But you could try upgrading to the very latest of RSVG or install Inkscape and see what happens. Your SVG file displays fine in my browser, though.

Perhaps one of the other IM users or developers could examine your SVG file and see what might be the issue.
dlemstra wrote:We just upgraded librsvg to the latest version (2.4.12) in the Windows distribution and we still have this issue. It seems that librsvg does not handle '
' properly. When I remove this from your file I get the correct result. You could report a bug here: https://bugzilla.gnome.org/enter_bug.cg ... ct=librsvg. Please add a link to your bugreport in this post if you decide to report it there.
Thanks for the replies. I reported the bug here https://bugzilla.gnome.org/show_bug.cgi?id=759231
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: SVG to JPG/PNG with ImageMagick PHP problem

Post by dlemstra »

Thanks for coming to this post. Please let us know when they fixed this issue so we can upgrade librsvg to the latest version for the Windows distribution.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply