Is there a tool to convert SVG line paths from absolute to relative?

两盒软妹~` 提交于 2019-12-06 01:10:51

问题


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?


回答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:


  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




回答3:


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.



来源:https://stackoverflow.com/questions/6890685/is-there-a-tool-to-convert-svg-line-paths-from-absolute-to-relative

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!