Search code examples
htmlsvginkscape

How to import SVG into Inkscape?


Is it possible to import code into Inkscape and save it as a .svg file?

I want to import this code and save it as an SVG file:

<svg class="defs-only" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <symbol id="wave">
    <svg viewBox="0 0 100 50" preserveAspectRatio="none">
      <g>
        <path d="M100,30 Q70,40 50,30 T0,30 v20 h100Z"
          style="stroke-linejoin:round; stroke:#f6f6f6" stroke-width="0"/>
      </g>
    </svg>
  </symbol>
</svg>

Solution

  • In Inkscape there's xml text editor (Edit > XML editor...) panel. There you can follow these steps:

    • Create a new element, call it: svg:path (this will create it with an id)
    • click unindent node to have it as a child from the main node (top one). You may want to keep it under a particular node too.
    • On the right hand side fill the list of attributes, by setting the name on the box next to the set button, and the value in the box below. Once you've enter the values click Set. This may seem obvious, but it took me a while to figure it out.

    A picture is worth a thousand words

    There's more detailed information about the xml editor on Tavmjong Bah's Guide to a vector drawing program