7

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
kareed
  • 91
  • 4
  • I'm having this problem on windows. – Stefan Rusek Jul 03 '11 at 09:59
  • Your problem is setting a PATH to new libraries/binaries. or uninstalling the old one libraries. Maybe you should try to find out which libraries are linked to binary and compile them together with newer version. try `otool -L` to find out – Marek Sebera Jul 07 '11 at 21:24
  • This is super easy to reproduce. 1. download the imagemagick binaries from their website 2. try to convert an svg file with traslations to a png using "convert src.svg targ.png" It would seem strange that such an important part of SVG support is just broken. – Stefan Rusek Jul 09 '11 at 12:56
  • 6
    How about to try with `inkscape` which also has command line interface. – kamae Jul 09 '11 at 17:33
  • 1
    Also try posting this question on ImageMagick's forum, they are very helpful. – Ivan Nov 22 '11 at 16:36

2 Answers2

1

I was experiencing this on 10.7, having installed imageMagick via macPorts. After trying and failing a couple of uninstall/reinstalls with differing options. I finally uninstalled and built from source, after installing librsvg, and now everything works using the updated svg libraries.

ImageMagick's unix source and instructions are here: http://www.imagemagick.org/script/install-source.php

ImageMagick also provides instructions on linking libraries and library paths explicitly in your configuration step (http://www.imagemagick.org/script/advanced-unix-installation.php) although I didn't have to do this.

megamatt
  • 11
  • 1
1

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.

Wes Hardaker
  • 21,735
  • 2
  • 38
  • 69