Page 1 of 1

list of implemented SVG elements?

Posted: 2015-08-23T20:59:59-07:00
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.

Re: list of implemented SVG elements?

Posted: 2015-08-23T22:36:38-07:00
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.

Re: list of implemented SVG elements?

Posted: 2015-08-24T05:22:08-07:00
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

Re: list of implemented SVG elements?

Posted: 2015-08-24T10:37:51-07:00
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?

Re: list of implemented SVG elements?

Posted: 2015-08-24T11:00:16-07:00
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.

Re: list of implemented SVG elements?

Posted: 2015-08-24T11:32:40-07:00
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?

Re: list of implemented SVG elements?

Posted: 2015-08-24T14:44:19-07:00
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?

Re: list of implemented SVG elements?

Posted: 2015-08-24T14:52:44-07:00
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.

Re: list of implemented SVG elements?

Posted: 2015-08-24T15:27:07-07:00
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

Re: list of implemented SVG elements?

Posted: 2015-08-24T18:02:41-07:00
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

Re: list of implemented SVG elements?

Posted: 2015-08-24T19:23:41-07:00
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.