10

I am using Inkscape as a canvas to layout existing PDF/SVG/PNG plots that I have made in Python, and then add some details and text to the overall figure. When I import the PDF/SVG files via File >> Import... >> Link, they are embedded in Inkscape. I have noticed that if I do this with a raster image I get the option to link to the file instead of embedding it, so that when I update the plots in Python, they are automatically updated in Inkscape.

I can not find how to link to PDF/SVG files in the same way. I wish to keep the full resolution PDF/SVG plots, instead of using rasters. My friend showed me how to do it in Adobe Illustrator with PDFs, but is this possible in Inkscape?

3 Answers 3

6

Linking to external SVG files (but apparently not pdf files) will be possible with Inkscape 1.0 (Release notes). In Inkscape it will still be converted to a raster image, but you can set the DPI on import and even afterwards. The rasterization happens inside Inkscape, so it does not increase the file size.

Also, if viewed in a browser, the linked svg file seems to be displayed as is (no rasterization)

Inkscape 1.0 is currently available as an alpha release.

1
  • 3
    As of 9/20/2019, the 1.0 beta, when converting to another format, will still export the raster images rather than rendering the SVG directly. The images are exported with the DPI chosen upon import of the SVG, not what is specified upon output, so make sure to specify a reasonable DPI when importing. Sep 20, 2019 at 16:21
4

You can link an Inkscape SVG inside another Inkscape SVG such that the linked file auto-updates in all files using it, like a linked raster image would. This is accomplished using the <image /> tag as follows:

  1. Create an image called dummy.png.
    • Use the same location as the SVG to link.
    • Use the same dimensions as linked image will be in the parent SVG.
  2. Import dummy.png as a raster image.
  3. Right-click the image.
  4. Select Image Properties.
  5. Set URL to the SVG file (use a relative URL).

The graphic will auto-update every time your linked SVG is updated, but will not be editable inside the host SVG file.

Alternatively, render a raster image of the source SVG itself and replace its URL with the SVG file's URL.

2
  • Thanks, I have tried using the <image> tag, but inkscape converts the linked file to a low resolution bitmap image, both for viewing in Inkscape and for export to other formats. Is this not the case for you? If so, could you post a full example of an image tag with an svg path inside that is rendered in full "resolution"? Feb 21, 2017 at 15:06
  • 1
    @cheflo, you're right, the linked file is a bitmap. I have used this feature in situations that I didn't have to worry about scaling the image and I didn't look carefully at what was happening. My bad. Feb 23, 2017 at 5:01
2

When you import a vector file into inkscape, it comes in as a group of vector objects. Thus resolution isn't an issue. I do this a lot for graphs from origin and python/matplotlib. This is easy to check - -click on a curve in your graph and select the "edit paths by node" tool (F2) - you'll be able to edit the nodes.

Auto-updating would be nice, but I don't think it can be done as a user (and I include simple extensions here). I've just tried hand-hacking an svg file to link a pdf (or svg) instead of a png, and the new file can't be found (I get a placeholder image containing "☒ Linked image not found").

If you have rasters embedded in your source svg/pdf files, I'm not sure what would happen to the resolution. The only time I've ever had to deal with this the images (cropped from microscope photos) were so low resolution that they were upscaled anyway and I didn't lose out further. I doubt you have problems with embedded rasters in python graphs anyway.

1
  • Thanks, I have also experienced the "Linked image not found"-error with PDFs. I was hoping there was a solution I had overseen, since it seems technically possible, given that the funtinoality exists in Illustrator. I guess the .ai format might be more permissive for these kind of things (although I have seen posts about svgs within svgs for webpage design). May 15, 2016 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.