I'me trying to use ImageMagick to convert SVG files to PNG.
The SVG file is as follows:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<image xlink:href="picture.jpg" width="200" height="200"/>
</svg>
No matter what method I use the final result doesn't include the image. Other SVG elements have rendered correctly.
I've tried:
convert test.svg test.png
rsvg-convert -o test.png test.svg
I've tried changing the image path to use file:///, absolute paths, remote urls, and url encoded variations of each. I've also formatted my file with and without a doctype.
I'm using librsvg 2.36.3 and ImageMagick 6.8.0-10 I have been able to use phantomjs to convert them but it seems like overkill for this one task.
Please help!
For me, installing gtk3 (or probably more specifically "shared-mime-info" helped. (and re-installing rsvg afterwards AND using absolute "file:///" uri for href AND having image file in same directory as svg file)
More info (I'm still confused what exactly is going on):
I think the problem is not with rsvg directly, but with gdk-pixbuf(2) library
I found the place in the code where gdk-pixbuf is used to load the image. I confirmed (using printf debuggin) that it doesn't throw an error (seems to load pixbuf just fine) even if the uri in the href does not point to a file.
the gtk3 dependency should only be necessary for rsvg-view-3 tool, not for rsvg, but it seems to be (or one of the dependencies that got pulled in when I installed gtk3)
It still works even after uninstalling gtk3. It even still works after uninstalling gtk3, then rebuilding rsvg (./configure detects: "gtk3: no"), so I figure it must have to do with one of the dependencies that got pulled when I installed gtk3:
atk-2.10.0-1-i686
(I'm leaving these here in case it's not the lib I identified in the end)
So I tried removing these deps in groups and rebuilding and testing in between. Turns out the one making it work is...
* shared-mime-info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With