I use the python rsvg bindings to render an svg image into cairo and save to file, which mostly works. But if the svg file contains a linked image, like so:
There are many factors which must be satisfied for LibRsvg to allow an image resource to be loaded. As of v2.40 these include:
xlink:href attributedata:// or file://file:// paths must be absolutefile:// paths must be in or below the path of the SVG source file (after any symlinks have been dereferenced)Note that if input is passed to rsvg-convert via stdin, then no paths count as subdirectories of the input file and all file:// images will be denied.
rsvg-convert < input.svg > output.png # images denied
rsvg-convert -o output.png input.svg # images allowed
The code governing image URL resolution can be found in the LibRsvg source in rsvg-base.c, function _rsvg_handle_allow_load.
To add a debugging notification to rsvg-convert when image loading fails, one can append
#define G_ENABLE_DEBUG
to config.h in the source and recompile.