Inkscape is a powerful open-source vector graphics editor which supports the inclusion of raster images either through file references (links) or through direct embedding of the image data in the Inkscape SVG file. Referencing images as links keeps SVG files small and ensures that changes to image placement and transformations specified in the SVG file remain separate from the underlying image data. However, embedding images may be required as a final step in some production work-flows.

This java-based extension for Inkscape facilitates image embedding by:

  • Automatically identifying all linked images.
  • Cropping image data that lies outside the images’ clipping frame.
  • Optionally applying jpeg compression.
  • Writing the cropped and possibly compressed image data directly in the SVG file.

By cropping image data that lies outside the clipping frame or applying jpeg compression, the resulting file size can be reduced significantly. Alternatively, if preserving image quality is a priority jpeg compression can be explicitly avoided.

The extension uses ImageJ to load and manipulate the image data and the Apache Commons Codec library to encode the data for embedding.

This extension was developed to help produce publication quality figures for scientific journals. Comments and suggestions are welcome via Github.

Installing the Inkscape Extension


  • Inkscape 0.48 or newer
  • Java SE8 or newer

Option 1: Build from source

Get the code and build the project using Maven: $ mvn package. Then unpack target/svg-embed-and-crop-<ver>-distr.zip as described below.

Option 2: Download compiled app



Unpack the entire contents of the archive to the Inkscape extension directory.

For Windows, this is probably something like:
C:\Users\<your user name>\AppData\Roaming\inkscape\extensions\
Note that the AppData directory may be hidden in the file manager. If this is the case, it can be accessed by manually entering the path in the address bar.

For Mac or Linux, this is probably something like:

Run Inkscape. If it was already running, you will have to restart it. The plugin can be run from the menu:
Extensions > Images > Embed and crop images

Known Issues

  • Images that have already been embedded are ignored.

  • Only clipping planes created from rectangles are currently supported.

  • PDFs saved from Inkscape may not include jpeg compression, even if images are embedded in the SVG as jpegs. Additional information is available here. A workaround is to embed images without compression, export a PDF, then compress images in the PDF using The PDF Shrinker.

  • On some 64bit Windows systems, Inkscape’s Python interpreter fails to recognize the JRE, even if it is correctly registered with the system. A workaround for this issue is to edit svg-embed-and-crop.py to include an absolute path to the JRE.

Release Notes

version 1.5

  • Fix resolution of certain relative image paths.
  • Allow output files to be created in new directories.
  • Update initiation script for compatibility with Inkscape 1.0.

version 1.4

  • Fixed bug affecting rotation and skew transformations.

version 1.3

  • Fixed bug causing Java to exit when calling the extension from other Java programs.

version 1.2

  • Fixed bug which resulted in non-default compression quality parameters being ignored.

version 1.1

  • Check for the JRE in some common locations. Partial workaround for problem finding system-registered JRE from 32bit Python interpreter on 64bit Windows.

Running from the Command Line

It is possible to run the app directly from the command line without running Inkscape:

java -classpath <install path> edu.emory.cellbio.svg.EmbedAndCrop
      [<input>] [-o <output> | -s] [-t <type> [-q <quality>]]
  • <install path> – Location of the app’s jar files, ending with /*.
    Ex.: /usr/some-dir/svg-embed-and-crop/*
  • <input> – Path to the input SVG file. If missing, the user will be presented with a file open dialog box.
  • -o <output> – Path to save the output SVG file with embeded images
  • -s – Present the user with a file save dialog to specify the output file
  • Note: If neither -o nor -s is specified, the output is sent to the standard output stream
  • -t <type> – Specify the type of image for encoding. Supported options are png or jpeg. If this is not specified, the user will be presented with a selection dialog.
  • -q <quality> – Quality parameter for jpeg compression. Default value is 0.85.


java -classpath /path/to/jars/* edu.emory.cellbio.svg.EmbedAndCrop -s -t jpeg -q 0.95
java -classpath /path/to/jars/* edu.emory.cellbio.svg.EmbedAndCrop input.svg -o output.svg