Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVG Converting using ImageMagick doesn't apply a translation correctly

I am on a Mac using Mac OS X 10.5, and I am trying to use ImageMagick to convert an SVG file to a PNG. The problem is when I use it the rotated image doesn't show up in the correct position. If I use Batik to convert the file, it works properly.

After doing some research I found a thread that talked about trying to upgrade the SVG library. Currently, I am using ImageMagick 6.6.5 and the SVG library is 2.7.7 according to "identify -list format". The thread I found recommended using librsvg 2.32.

I have tried using port to install the updated SVG library and using port to reinstall ImageMagick. The problem and the question I have is no matter what I do with port I can't get it to use the newer version of the SVG library. It stays at 2.7.7. How do I get it to use the new library?

like image 527
kareed Avatar asked May 20 '11 07:05

kareed


1 Answers

Unfortunately, I went down this path for a while too. After a very long time beating my head against the wall and getting fairly bruised in the process, I found the only thing that worked was inkscape. Everything else just doesn't pull it off. Unfortunately, inkscape's CLI interfaces aren't great and don't offer you nearly as much flexibility as you'd like (especially when converting to PDFs, etc), it does at least work better than everything else. To use it:

inkscape -f INPUT.SVG -e OUTPUT.PNG

See inkscape --help for aditional details.

Extra word of warning: inkscape -h actually doesn't do what you want for help and launches the GUI.

like image 95
Wes Hardaker Avatar answered Oct 05 '22 03:10

Wes Hardaker