list of implemented SVG elements?

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
pumplerod
Posts: 6
Joined: 2013-12-06T15:24:24-07:00
Authentication code: 6789

list of implemented SVG elements?

Post by pumplerod »

I'm using PHP and building SVG images which are displayed in the browser. I also want to save the SVG as a png or jpg file.

For the most part this works with some of the basic SVG elements such as circle, rect, polygon, path, etc... Unfortunately when I apply a filter, such as <feGaussianBlur> the image looks fine in the web browser however the blur is not applied when I read the SVG with imagick and attempt to write a png.

I'm looking for a list of SVG elements https://developer.mozilla.org/en-US/doc ... VG/Element which imagemagick is actually able to read and apply.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: list of implemented SVG elements?

Post by fmw42 »

Imagemagick uses a delegate library to read SVG files. There are 3 you can use: Inkscape, RSVG and the internal Imagemagick MSVG. You should use one of the first two as they are more functional that the internal MSVG (xml). You can check which you are using by

Code: Select all

convert -list format
and see what is listed for SVG. For example, I have


SVG SVG rw+ Scalable Vector Graphics (RSVG 2.40.2)

but Inkscape may be even better.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: list of implemented SVG elements?

Post by snibgo »

Of the three, Inkscape implements the most features. It is also the slowest. Sadly, Inkscape documentation is incomplete and out of date. There doesn't seem to be a list of supported SVG features. It implements most SVG standard 1.1 elements, and some draft standard 1.2.

There is a list of filter effects implemented since Inkscape v0.46: http://wiki.inkscape.org/wiki/index.php/Filter_Effects
snibgo's IM pages: im.snibgo.com
pumplerod
Posts: 6
Joined: 2013-12-06T15:24:24-07:00
Authentication code: 6789

Re: list of implemented SVG elements?

Post by pumplerod »

Interesting. I had no idea.

How do I get imagemagick (convert) to use inkscape? I've installed inckscape using homebrew and it is now in my executable path however it still doesn't show up as the tool for converting SVG. Do I need to update a setting somewhere?

I notice that when I list the svg delegate I get this...
svg => "rsvg-convert" -o "%o" "%i"

however listing the format still yields...
SVG rw+ Scalable Vector Graphics (XML 2.7.3)

what is the difference as far as imagemagick is concerned?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: list of implemented SVG elements?

Post by snibgo »

"convert -list format" is not a reliable indicator of whether Inkscape will be used. As far as I know, the only reliable method is to convert with "-verbose" and read the output.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: list of implemented SVG elements?

Post by fmw42 »

I have not tried to use Inkscape, but I do use RSVG. I get all my delegates from MacPorts and then compile IM from source. See viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202. But to get RSVG rather than XML, I had to add --with-rsvg to my ./configure command. Perhaps you need to add --with-inkscape?
pumplerod
Posts: 6
Joined: 2013-12-06T15:24:24-07:00
Authentication code: 6789

Re: list of implemented SVG elements?

Post by pumplerod »

interesting.

When I run convert from the command line with -verbose I see:

Code: Select all

    "inkscape" "bozo.svg" --export-eps="/var/tmp/magick-91701yQtvhs1snIyc" --export-dpi="90,90" --export-background="rgb(100%,100%,100%)" --export-background-opacity="1" > "/var/tmp/magick-91701WAfrCDIJp9ZZ" 2>&1 
So it would appear to be running inkscape.

it does still error out with:

Code: Select all

dyld: Library not loaded: /usr/X11/lib/libXt.6.dylib
  Referenced from: /Applications/MAMP/Library/bin/gs
  Reason: image not found
Assuming I can get over this hurdle, I guess the next question is; I am ultimately running this through a php web app, using php compiled with Imagick. If I get this working with imagemagick via convert does that mean it should also work through Imagick, or is that a totally different animal?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: list of implemented SVG elements?

Post by snibgo »

pumplerod wrote:--export-eps="/var/tmp ...

... Referenced from: /Applications/MAMP/Library/bin/gs ...
What version of IM are you running? For a while, IM rasterised SVG by telling Inkscape to create EPS files. Then IM would tell Ghostscript to convert the EPS to something that IM could process directly.

More recently, IM tells Inkscape to create PNG files, so GS isn't needed. This is far more sensible.
snibgo's IM pages: im.snibgo.com
pumplerod
Posts: 6
Joined: 2013-12-06T15:24:24-07:00
Authentication code: 6789

Re: list of implemented SVG elements?

Post by pumplerod »

thank you snibgo,

I'm using:

Code: Select all

Version: ImageMagick 6.8.9-7 Q16 x86_64 2015-03-04 http://www.imagemagick.org
I simply ran:
brew install imagemagick

so I'm not sure how to make sure ghostscript is not included. I do see that if I simply convert using inkscape the conversion works.

Code: Select all

inkscape testFile.svg testResult.png
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: list of implemented SVG elements?

Post by 246246 »

pumplerod wrote:How do I get imagemagick (convert) to use inkscape?
I have not tried on MacOS but is this setting in delegates.xml be your help?

http://stackoverflow.com/questions/1132 ... k#12608890
Last edited by 246246 on 2015-08-25T04:38:53-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: list of implemented SVG elements?

Post by fmw42 »

ImageMagick 6.8.9-7
Perhaps you should try upgrading IM, An install would also make sure it sees Inkscape if it is installed correctly.
Post Reply