There are many factors which must be satisfied for LibRsvg to allow an image resource to be loaded. As of v2.40 these include:
- the image must have an
xlink:href
attribute
- that attribute must contain a full, valid URI
- the scheme can be
data://
or file://
file://
paths must be absolute
file://
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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…