By default, any bitmap you import into Inkscape is linked to the document. This means that the actual content of the bitmap is taken from the original bitmap file; what the SVG document contains is just a reference to that file—its filename, including path. This way, the SVG file size is kept to a minimum, and multiple SVG documents can reuse the same bitmap file. The status bar description of a linked bitmap object reports its filename (Figure 18-1).
This also means that any changes you do to that linked bitmap file outside of Inkscape (for example, color correction or cropping) will be immediately reflected in the Inkscape document. Moreover, you can run an external editor (such as GIMP or Photoshop) on your linked image from inside Inkscape by right-clicking the bitmap object and choosing Edit externally. On the Bitmaps page of Inkscape Preferences (3.1.1 Inkscape Preferences), you can disable the automatic reloading of changed bitmaps as well as choose which external editor you want to use.
The biggest disadvantage of linked bitmaps is how easy it is to disrupt this link. If the bitmap file is deleted or moved to a different location relative to the SVG document, the result is not pretty, as Figure 18-2 demonstrates.
This is a common problem when you send your art to someone but forget to include the linked images.
What matters for Inkscape is the relative location of the bitmap, because in the xlink:href
attribute of the svg:image
object, it stores a relative path from the SVG document location to the image file. For example, if the bitmap is in the images subfolder of the folder in which your SVG document resides, you can move that folder along with its images subfolder to any location on your computer without a problem.
Moreover, Inkscape to some extent protects you against a situation where you move the SVG document to another location on the same computer but leave the linked image behind. Inkscape additionally stores the absolute path to the image in the sodipodi:absref
attribute and tries to use it if the relative link in xlink:href
fails. This won’t help, however, if you move your SVG onto a different computer without its associated images.
There is a way to prevent these linking problems once and for all by embedding an image into your SVG document. An embedded image is stored right inside the SVG file and will never be lost. On the downside, this increases the file size of the SVG file (by about 1.4 times the file size of the bitmap file, which may be significant); also, embedded images cannot be edited in an external bitmap editor.
To embed one or more images into the document, use Extensions ▸ Images ▸ Embed Images. You have the choice of embedding only the selected bitmap object (leaving all others as they are) or embedding all the bitmap objects in the document:
An embedded image is described in the status bar as, for example, Image 64 × 64: embedded. With Extensions ▸ Images ▸ Extract Image, you can reverse the embedding of a bitmap—that is, extract an embedded image into a separate linked file; you will be asked for the path to save the extracted file to.