问题
I've got an SVG image as follows that I'm trying to convert to a PNG:
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<image x="0" y="0" width="158" height="158"
xlink:href="http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png" />
</svg>
This was working on Ubuntu 10.04, but now on 12.04 it doesn't. The reason appears to be that RSVG now won't load any image URL that doesn't have a relative path.
That's not an option here - my website generates the SVG (so I know it's safe) but it requires that the images are loaded in via HTTP.
The image displays fine in Chrome, but not in Imagemagick, Gimp, or (strangely) Inkscape.
If it helps I'm using Imagemagick via PHP, but RSVG is the delegate for SVG conversion here.
Does anyone have any ideas for how to get around this, short of recompiling librsvg?
I've tried the suggestions at ImageMagick (RSVG) won't import images in SVG and it looks suspiciously like it's this problem: rsvg doesn't render linked images
I found the code that's responsible here: https://git.gnome.org/browse/librsvg/tree/rsvg-base.c#n2169
I could be wrong, but it seems like they've disabled loads from other URLs, without any way to re-enable it short of a recompile?
来源:https://stackoverflow.com/questions/26364748/using-rsvg-to-convert-svg-with-non-local-image