Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

embed linked SVG images

Tags:

svg

inkscape

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)

like image 763
fommil Avatar asked Jun 21 '15 14:06

fommil


People also ask

Can you embed a image in a SVG?

Much like the img element in HTML SVG has an image element to serve the same purpose. You can use it to embed arbitrary raster (and vector) images. The specification requests applications to support at least PNG, JPEG and SVG format files.

Can I put an SVG inside another SVG?

The SVG format allows for the nesting of SVG graphics. It is possible for an “<svg>” elements, to be placed within another “<svg>” element. Though, within a nesting, the absolute placement is limited to the respective parent “<svg>” element.

How do I embed an SVG file?

SVG images can be written directly into the HTML document using the <svg> </svg> tag. To do this, open the SVG image in VS code or your preferred IDE, copy the code, and paste it inside the <body> element in your HTML document. If you did everything correctly, your webpage should look exactly like the demo below.

Can you embed SVG in HTML directly?

You can embed SVG elements directly into your HTML pages.


1 Answers

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

ExtensionsImagesEmbed Images

Quite easily! 🎉

like image 168
Jamie Pate Avatar answered Oct 11 '22 19:10

Jamie Pate