embed linked SVG images

5.9k views Asked by At

I have an SVG file that references lots of other, smaller, SVGs as sub images. Effectively, the main SVG is the template that positions all the other ones.

I'd like to create a single image that I can pass on to people - i.e. a data ref or just inline inclusion - but running the inkscape Embed Images extension results in the error "images are not of type PNG, JPEG, etc".

So it sounds like the inkscape (v0.48.5) extension can only intern bitmap images, not SVGs. Bummer.

My images are referenced from the master SVG like this

<image id="PGDOWN_R1" x="1436.5"  y="280"  xlink:href="./symbols/PGDOWN_R3.svg"/>

So how can I automatically intern/embed all my externally referenced SVGs? (non-inkscape CLI options are welcome too)

2

There are 2 answers

3
fommil On BEST ANSWER

I ended up using xmllint to parse an SVG file with handles into a file containing the embedded versions of the referenced files, which is not exactly what I mean but it suited my purposes: https://gitlab.com/fommil/attic/blob/master/kinesis-dvorak/create.sh#L37

xmllint --xinclude picture.svg  > picture-embedded.svg
2
Jamie Pate On

At least as of Inkscape 0.91 you can do this through this menu:

ExtensionsImagesEmbed Images

Quite easily!