PAID: Need help converting SVG to PNG with IMagick

Do you need consulting from ImageMagick experts and are willing to pay for their expertise? Or are you well versed in ImageMagick and offer paid consulting? If so, post here otherwise post elsewhere for free assistance.
Post Reply
pfriedl
Posts: 12
Joined: 2015-04-22T10:00:38-07:00
Authentication code: 6789

PAID: Need help converting SVG to PNG with IMagick

Post by pfriedl »

Please see my previous post here:
viewtopic.php?t=28725

We've got most of the code done, but we're having an issue with IMagick/ImageMagick shifting grouped items in an SVG down and to the right. The codebase is php 5.5+ on a CentOS server. ImageMagick 6.9.2-4 Q16 x86_64 2015-10-19 and IMagick 3.1.2.

You can send a PM through the board o email me at pfriedl_at_gmail.com. Thanks!
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: PAID: Need help converting SVG to PNG with IMagick

Post by dlemstra »

I am pretty sure that you are using msvg (The svg reader of ImageMagick) instead of inkscape. When I convert your file and force ImageMagick to use msvg I get the same result. When I use rsvg (The windows default) it produces the result that you want. I just did a quick search online and it turns out that IMagick uses a delegates.xml file in php.5.5.X/ext/imagick. Can you check if you have a delagates.xml file for IMagick and is it configured to use inkscape instead of msvg?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
pfriedl
Posts: 12
Joined: 2015-04-22T10:00:38-07:00
Authentication code: 6789

Re: PAID: Need help converting SVG to PNG with IMagick

Post by pfriedl »

Hmmm, I was under the impression that ImageMagick would default to inkscape if inkscape was installed. I have verified that inkscae is installed and working on the server, but I wasn't aware that I needed a delegates.xml. I'll definitely check...

I ran the command "convert -list delegate", and it looks like it's still using rsvg: svg => "rsvg-convert" -o "%o" "%i"

To change to inkscape, what does this need to be changed to?

Thanks for the help on this - I've been tearing my hair out trying to figure this out!
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: PAID: Need help converting SVG to PNG with IMagick

Post by dlemstra »

You will probably get the correct result with rsvg on the command line. But IMagick will not execute the convert command. I am not a php/imagick expert so I don't know where the delegates.xml file is located.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
pfriedl
Posts: 12
Joined: 2015-04-22T10:00:38-07:00
Authentication code: 6789

Re: PAID: Need help converting SVG to PNG with IMagick

Post by pfriedl »

Thanks for the fast reply.

I won't be able to use command line as this is running in a web app (not command line, but on an automated, bulk scale) and I'm using IMagick and an instance of an ImageMagick object in the code so I can build composite images after converting the SVG.

So do I need to change the svg handler in the delegates.xml file to inkscape, and if so, how?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: PAID: Need help converting SVG to PNG with IMagick

Post by dlemstra »

Do you have a delegates.xml file in the imagick php folder on your system? Copying the delegates.xml file from your home directory to that php folder will tell it to use rsvg instead of msvg. That should produce the correct imge. But if you want to use inkscape you will need to change the svg:decode delegates. You can find an example here: http://stackoverflow.com/questions/1132 ... magemagick
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PAID: Need help converting SVG to PNG with IMagick

Post by fmw42 »

Why can you not just put the Imagemagick command line in a PHP exec() command? It runs just as good as Imagick and has more flexibility in terms of Imagemagick functionality.
Post Reply