Direkt zum Hauptinhalt

SVG Embed And Crop Linked Images

Sources:

requires to install Java

#Fedora
sudo dnf install java-latest-openjdk.x86_64

About

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
  • Optionally resampling images above a maximum resolution
  • Writing the cropped and possibly compressed image data directly in the SVG file

By cropping image data that lies outside the clipping frame, applying jpeg compression, or resampling to lower resolution, the resulting file size can be reduced significantly. If preserving image quality is a priority jpeg compression and resampling can be explicitly avoided.

Known Issues

  • Images that have already been embedded are ignored.

  • Only clipping planes created from rectangles are currently supported.

  • In Inkscape versions >= 1.0, non-ASCII characters in text elements may be disrupted on some systems. This is dues to an issue with the new extension system; a fix has been proposed. Workarounds include using Inkscape versions < 1.0 or editing share/inkscape/extensions/inkex/extensions.py in your Inkscape installation as detailed here.

  • 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.

  • cannot access some files from regular user "can't read file link"