Inkscape cannot link SVGs, only bitmaps

Asked by papaki on 2010-01-19

I am trying to create an SVG with two linked SVGs imported. In this way, if one day, one of these two images is modified, I will get an error message when opening by composite SVG. Though, linking seems to work only for bitmaps. Is there a way to import SVGs in Inkscape (as for example happens with eps in Illustrator)?

Question information

Language:
English Edit question
Status:
Answered
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Last query:
2010-01-19
Last reply:
2010-01-19
su_v (suv-lp) said : #1

Do you mean 'Link' or 'Import'? (I'm aware that the current UI is inconsistent in its use of the terms 'import', 'link' and 'embed' for bitmap images ;-). I haven't seen how Illustrator links, imports or embeds EPS files, but here's what I know about linking external SVG files in Inkscape:

a) import SVG file
You can import an SVG by using the 'File > Import…' dialog, however - this will embed the imported SVG source into the current document, encapsulated in a group in the current layer.
b) link SVG file
To link an external SVG file into your current document you could use the <image xlink:href="…" …> element, however there's no UI or dialog implemented for this in current Inkscape version. And - while it basically works on linux and osx, it seems still broken on win32 platforms. And - if the referenced SVG document can be found - there's still the issue that its content is rendered at a fixed resolution and doesn't scale as regular vector objects do in the current document.
<http://www.w3.org/TR/SVG11/struct.html#ImageElement>
c) …other methods?
- Unlike <image>, the element <use> cannot reference entire SVG files. Its xlink:href attribute is a reference to an element/fragment within an SVG document (<http://www.w3.org/TR/SVG11/struct.html#UseElement>). The 'use' element can reference any local or non-local resource (<http://www.w3.org/TR/SVG11/struct.html#uriReferenceDefinition>). However I don't know if and to which extent this is support by Inkscape and/or other SVG viewers.
- Maybe <http://www.w3.org/TR/SVG11/linking.html> has pointers to further available methods.

My conclusion at the time: this feature seems not yet fully supported by Inkscape 0.47.

some RFE / bug reports related to linking SVG as <image>:
Bug #171544 “Use the <image> tag to import another SVG file”:
<https://bugs.launchpad.net/inkscape/+bug/171544>
Bug #168244 “image tag does not find SVG source”:
<https://bugs.launchpad.net/inkscape/+bug/168244>
Bug #171795 “Don't rasterize linked SVG with <image>”:
<https://bugs.launchpad.net/inkscape/+bug/171795>
Bug #461842 “Image filter effect using path has low resolution”:
<https://bugs.launchpad.net/inkscape/+bug/461842>

Maybe someone else knows more about plans to implement a GUI/dialog and to improve the handling of referenced external SVG documents.

su_v (suv-lp) said : #2

I tested a simple document referencing fragments in an external SVG file with <use xlink:href="MyLibrary.svg#block-XX" …> - this fails in Inkscape 0.47 and in Safari 4.0.4 (i.e. the linked fragments are not rendered at all) but it is rendered as I would expect it in Firefox 3.5.6 and Batik 1.7.

code snippets:
MyLibrary.svg:
        <rect x="0" y="0" width="200" inkscape:label="upper-left-blue"
              style="fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:none"
              id="upper-left-blue" height="200"/>

UseParts.svg:
        <use x="0" y="0" width="400" xmlns:xlink="http://www.w3.org/1999/xlink"
             xlink:href="blocks.svg#upper-left-blue" xlink:type="simple"
             xlink:actuate="onLoad" height="400" id="use8793" xlink:show="embed"/>

Jimmy Volatile (spam-useful) said : #3

Yeah. I'm definitely missing this feature as well.
Not only is it a very powerful way of working with common elements and files across documents (the same way you would with images), it also is an integral part to the SVG-spec.

Thanks for testing the <use> element. I wasn't aware of this at all :)

PeterPall (peterpall) said : #4

Am currently facing the same problem.

Pander (pander) said : #5

This works in Linux 0.48.2

Add line with gedit/vim
   xmlns:xlink="http://www.w3.org/1999/xlink"
after line
   xmlns="http://www.w3.org/2000/svg"

And add before lines
  </g>
</svg>
these lines
    <image
       sodipodi:absref="/home/bla/blabla.svg"
       xlink:href="blabla.svg"
       height="2294"
       width="2001"
       id="imageblabla"
       y="-1584.5991"
       x="51.862183" />

You can omit height and width and set x and y to "0". After opening the SVG file in inkscape it is possible to correctly position the image and change its dimensions.

tebi (tebicap) said : #6

I need this feature!!

Thanks for your comments!

PeterPall (peterpall) said : #7

Since there currently seems to be no answer for this question the only way to go is the bug report linked to it: All feature requests for inkscape are managed using the bug tracker functionality of launchpad.

Kind regards,

        Gunter

Can you help with this problem?

Provide an answer of your own, or ask papaki for more information if necessary.

To post a message you must log in.