Resources on supported SVG properties...

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
kpettit

Resources on supported SVG properties...

Post by kpettit »

I am looking for documentation on using IM to convert SVG's to ...

Can anyone point me?

I am specifically looking for:
* Font Support
* Filter support
* Masking
* Gradients

Thanks,
Ken...
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Resources on supported SVG properties...

Post by anthony »

See IM examples (link in sig)
Especially look in the 'Drawing' section.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
kpettit

Re: Resources on supported SVG properties...

Post by kpettit »

Thanks,
Does this mean that SVG is not yet supported? From what I'm finding I will need to
parse the SVG then pass commands to IM to recreate the file.

ie. Read the SVG...:

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 width="5cm" height="4cm" viewBox="0 0 500 400"
     xmlns="http://www.w3.org/2000/svg" version="1.1">
  <rect class="Border" x="1" y="1" width="498" height="398" />
  <path class="SamplePath" d="M10,30 C10,4 50,30 S90,55 90,30" />
</svg>
Then create IM command:

Code: Select all

convert path_cubic_canvas.gif  -fill none -stroke black \
            -draw "path 'M 10,30  C 10,4 50,4 50,30  S 90,55 90,30' " \
            path_cubic.gif
instead of:

Code: Select all

convert image1.svg image1.png
This is a simple example... The SVG files I want to convert can be rather complex. Would rather not
add the additional scripting and processing if I could help it.

So is there any other documentation as to what SVG properties are supported? Or should I create a PHP SVG to IM command library?

Thanks,
Ken...
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Resources on supported SVG properties...

Post by anthony »

IM will read SVG files directly. It handls then in two different ways depending on your system.

It may use the librsvg libraries to convert the SVG to a raster image, OR it converts it itself to the MVG drawing commands format. The later however is still incomplete with regards to gradients and a few other things, but this is being worked on.

What you see in the IM examples is the MVG drawing format. There is also some talk about the SVG format which is why I directed you to that page.

try this...

Code: Select all

    convert -density 100  image.svg   image.png
You can also use x: instead of image.png to display the result directly on an X window display, is you are in a UNIX environment.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply