Speed up svg -> jpg conversion

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
BigNoub
Posts: 33
Joined: 2015-12-29T14:49:52-07:00
Authentication code: 1151

Speed up svg -> jpg conversion

Post by BigNoub » 2019-01-03T11:55:56-07:00

I'm using Imagemagick 7.0.8-14 on ubuntu 16.04

I'm trying to convert some fairly big (80Mo) svg files to jpg using a simple convert command. The process takes a couple of hours, is there a way to speed that up? I've tried doing the same thing manually with inkscape, it takes a couple of minutes to load the svg file, and a couple of seconds to write it as jpg.

If you know a better option than imagemagick to do this job I'll be happy to use it, as long as it's command-line based.

Edit: I was able to convert under a few seconds using inkscape command line, but if there is a way to speed up the process with Imagemagick too I'm also willing to know it :lol:

User avatar
magick
Site Admin
Posts: 11095
Joined: 2003-05-31T11:32:55-07:00

Re: Speed up svg -> jpg conversion

Post by magick » 2019-01-03T17:01:05-07:00

ImageMagick supports 3 different SVG renderers. One of them is inkscape. To find out which ImageMagick utilizes type `magick -list format` and look for SVG. Which renderer are you using?

Can you post a URL to an SVG file that takes a long time to process? If you do, we'll use it to fix the performance issue.

BigNoub
Posts: 33
Joined: 2015-12-29T14:49:52-07:00
Authentication code: 1151

Re: Speed up svg -> jpg conversion

Post by BigNoub » 2019-01-04T09:43:16-07:00

I made a mistake, I run ImageMagick 6.9.7-4 on Ubuntu 18.04. I can't really update as it's not my server.

I think I can't run

Code: Select all

magick  -list format
with this version? I tried

Code: Select all

convert -list format
but got

Code: Select all

SVG  SVG       rw+   Scalable Vector Graphics (XML 2.9.4)
I don't think that's what you're looking for?

Here is an svg you can use for your tests:

https://drive.google.com/file/d/1YJUyP0 ... sp=sharing

running a simple

Code: Select all

convert in.svg out.jpg
took me 3 hours and 10 minutes.

User avatar
fmw42
Posts: 25752
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Speed up svg -> jpg conversion

Post by fmw42 » 2019-01-04T11:17:02-07:00

SVG SVG rw+ Scalable Vector Graphics (XML 2.9.4)
This says your are using XML which uses MSVG for the renderer.

User avatar
magick
Site Admin
Posts: 11095
Joined: 2003-05-31T11:32:55-07:00

Re: Speed up svg -> jpg conversion

Post by magick » 2019-01-04T16:43:44-07:00

Your file has 359222 path elements. You want to build ImageMagick with one of the delegate SVG renderers, with RSVG or Inkscape. The internal renderer has performance issues with that many path elements.

BigNoub
Posts: 33
Joined: 2015-12-29T14:49:52-07:00
Authentication code: 1151

Re: Speed up svg -> jpg conversion

Post by BigNoub » 2019-01-05T09:52:36-07:00

OK. I couldn't find easily how to specify the renderer in the doc, do I just need to have inkscape installed and in my path?

User avatar
fmw42
Posts: 25752
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Speed up svg -> jpg conversion

Post by fmw42 » 2019-01-05T11:11:39-07:00

BigNoub wrote:
2019-01-05T09:52:36-07:00
OK. I couldn't find easily how to specify the renderer in the doc, do I just need to have inkscape installed and in my path?
That should work.

You can find what you have now by

Code: Select all

convert -list format
and look at the end of the line for SVG. It will likely be either XML (for the IM internal MSVG) or RSVG delegate

Post Reply