I created a simple SVG file in Inkscape as a test, just with a black triangle.

I duplicated that.

I edited the first file and put an

<svg:image xlink:href="b.svg" width=20 height=20 x=10 y=10 />

element in. The 2nd file is rendered but blurry:

sample image

I'd understand if I had linked a raster image and rendered it too large, but this is an svg file!

Is there a way to stop Inkscape doing this (i.e. am I missing some important attribute or such) or is this a bug/poor implementation?

Here's the main SVG file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
   viewBox="0 0 30 30"
       d="M 0,10 10,0 v 10 z"
       style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
       height="20" />

(the other one is the same without the <svg:image> tag)


I found a bug report which pointed to an answer on stackoverflow

I therefore can't take any credit for this but the way to fix it was to change:

<svg:image xlink:href="other.svg" x=1 y=2 width=3 height=4 />

to something like this:

<g transform="...">
  <svg:use xlink:href="other.svg#layer1" x=1 y=2 />


  • The <g> element is only needed to apply a transform to restore the desired size; width attributes are ignored on use (it seems). (You could probably apply the transform directly, I'm not sure.)

  • The xlink:href attribute gets a #layer1 appended to it. This is important (won't work without it). It refers to a node id in the referenced SVG. If you made that with Inkscape, #layer1 is probably what you want.

This fixed things for inkscape (and also worked in Firefox, FYI).

  • your original code looks fine in a browser on a mac. where were you viewing the blurry triangle? (the use instance has its own attributes)
    – theship
    Sep 6 '19 at 2:17
  • yes, it works in firefox too. but not in inkscape. As I use a script to generate pngs from svg using inkscape, I needed inkscape to work. Sep 6 '19 at 10:59

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.