7

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 instead, I get to 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 this is possible in Adobe Illustrator with pdfs, but I can't seem to figure it out in Inkscape, is it possible? If so, how do I go about it?

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.

  • 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"? – joelostblom Feb 21 '17 at 15:06
  • @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. – lost-and-found Feb 23 '17 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.

  • 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). – joelostblom May 15 '16 at 3:31
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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