14

Looking for a tool to convert something like

M10 20L0 0 5 5 10 10

from the absolute position to relative, something like:

M10 20l-10 -20 5 5 5 5

Notice the uppercase L for absolute and lowercase l for relative?

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Kenneth
  • 611
  • 2
  • 8
  • 17

4 Answers4

17
  1. Open Inkscape and select File, Inkscape Preferences (or Shift + Ctrl + P)

  2. Select SVG output

  3. In the path data section untick Allow relative coordinates or select always use absolute coordinates depending on your version of Inkscape.

    This will only affect newly created paths or existing objects for which a rewrite of the path data is triggered. For existing paths:

  4. Select Edit, then Select All in All Layers.

  5. Use the arrow key to nudge the selection (e.g. one step up and one back down again). This will trigger a rewrite of the path data in d which will follow the changed preferences for absolute path values.

This works for Inkscape 0.48

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Derek Ewing
  • 223
  • 2
  • 8
  • Thanks for saving my day! I was going nuts after setting the preferences and yet seeing no change in the result. The extre nudge step was exactly what I needed :D – waldyrious Sep 14 '16 at 16:01
  • Note: **the layers must be visible** for the selection to work. – waldyrious Sep 14 '16 at 17:52
  • 3
    This preference appears to have moved as of Inkscape 1.0.x. It is now located at Edit > Preferences > Input/Output > SVG Output.  For the Path data "Path string format", select "Relative". – NaderNader Dec 23 '20 at 18:05
5

For who's still searching for this tool. There is one made by Lea Verou on codepen that convert paths to relative or absolute.

Example convert this:

M233.51,56.8c-0.57,0.24-1.33,0.52-2.28,0.86c-0.95,0.33-1.93,0.5-2.92,0.5s-1.84-0.27-2.53-0.82
c-0.69-0.55-1.03-1.49-1.03-2.82V36.25h7.85V28.9h-7.85V16.77h-9.56V28.9h-17.84V16.77h-9.56V28.9h-4.92v7.35h4.92v21.48
c0,1.67,0.26,3.08,0.79,4.25c0.52,1.17,1.22,2.12,2.1,2.85c0.88,0.74,1.9,1.27,3.07,1.61c1.16,0.33,2.41,0.5,3.75,0.5
c2.05,0,4-0.28,5.85-0.86c1.86-0.57,3.42-1.14,4.71-1.71l-1.93-7.56c-0.57,0.24-1.33,0.52-2.28,0.86c-0.95,0.33-1.93,0.5-2.92,0.5
c-1,0-1.84-0.27-2.53-0.82c-0.69-0.55-1.03-1.49-1.03-2.82V36.25h17.84v21.48c0,1.67,0.26,3.08,0.79,4.25
c0.52,1.17,1.22,2.12,2.1,2.85c0.88,0.74,1.9,1.27,3.07,1.61c1.16,0.33,2.41,0.5,3.75,0.5c2.05,0,4-0.28,5.85-0.86
c1.86-0.57,3.42-1.14,4.71-1.71L233.51,56.

Into this:

M233.51,56.8c-0.57,0.24,-1.33,0.52,-2.28,0.86c-0.95,0.33,-1.93,0.5,-2.92,0.5s-1.84,-0.27,-2.53,-0.82c-0.69,-0.55,-1.03,-1.49,-1.03,-2.82v-18.27h7.85v-7.35h-7.85v-12.13h-9.56v12.13h-17.84v-12.13h-9.56v12.13h-4.92v7.35h4.92v21.48c0,1.67,0.26,3.08,0.79,4.25c0.52,1.17,1.22,2.12,2.1,2.85c0.88,0.74,1.9,1.27,3.07,1.61c1.16,0.33,2.41,0.5,3.75,0.5c2.05,0,4,-0.28,5.85,-0.86c1.86,-0.57,3.42,-1.14,4.71,-1.71l-1.93,-7.56c-0.57,0.24,-1.33,0.52,-2.28,0.86c-0.95,0.33,-1.93,0.5,-2.92,0.5c-1,0,-1.84,-0.27,-2.53,-0.82c-0.69,-0.55,-1.03,-1.49,-1.03,-2.82v-18.28h17.84v21.48c0,1.67,0.26,3.08,0.79,4.25c0.52,1.17,1.22,2.12,2.1,2.85c0.88,0.74,1.9,1.27,3.07,1.61c1.16,0.33,2.41,0.5,3.75,0.5c2.05,0,4,-0.28,5.85,-0.86c1.86,-0.57,3.42,-1.14,4.71,-1.71l-1.97,-7.57z

https://codepen.io/leaverou/pen/RmwzKv

Mattia Astorino
  • 1,396
  • 14
  • 18
2

In settings, under "SVG Output", set "Path string format" to "Absolute" and save as plain SVG. You may have to nudge the object so Inkskape will reset the 'd' attribute for the path.

Tyler
  • 512
  • 6
  • 8
1

Found a tool called Inkscape which allows saving to relative.

To do this:

  1. New document, create a random pencil path, and save the SVG. Close inkscape.
  2. Edit saved file in a text editor. Find and replace the pencil path with your path
  3. Re-open the document in Inkscape. Locate and move your path. Save.
  4. Edit the file again and look for the new relative path.

TADA

  • 2
    No longer true or reliable. Inkscape calculates which path segment will be shorter and picks absolute or relative notation based on that. You move a shape a few pixels too close to coordinate grid and you will see absolute instructions injected. see http://inkscape-forum.andreas-s.net/topic/1968810 – ddotsenko Sep 23 '12 at 18:38