有没有一个工具可以将 SVG 线条路径从绝对路径转换为相对路径?

发布于 2024-11-27 08:08:17 字数 196 浏览 0 评论 0原文

正在寻找一种工具来将

M10 20L0 0 5 5 10 10

绝对位置转换为相对位置,例如:

M10 20l-10 -20 5 5 5 5

注意大写的 L 表示绝对位置,小写的 l 表示相对位置?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

银河中√捞星星 2024-12-04 08:08:18
  1. 打开 Inkscape 并选择文件Inkscape 首选项(或 Shift + Ctrl + P)

  2. 选择SVG 输出

  3. 路径数据部分中取消选中允许相对坐标或选择始终使用绝对坐标,具体取决于在您的 Inkscape 版本上。

    这只会影响新创建的路径或触发路径数据重写的现有对象。对于现有路径:

  4. 选择编辑,然后选择所有图层中的全部

  5. 使用箭头键轻推所选内容(例如向上一级,再向下一级)。这将触发d中路径数据的重写,它将遵循绝对路径值的更改后的首选项。

这适用于 Inkscape 0.48

  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

御弟哥哥 2024-12-04 08:08:18

对于仍在寻找此工具的人。 Lea Verou 在 codepen 上制作了一个可以将路径转换为相对路径或绝对路径的工具。

示例将其转换

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.

为:

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

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

﹎☆浅夏丿初晴 2024-12-04 08:08:18

在设置中,在“SVG 输出”下,将“路径字符串格式” 设置为“绝对” 并保存为纯 SVG。您可能需要轻推对象,以便 Inkskape 重置路径的“d”属性。

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.

奶气 2024-12-04 08:08:18

找到了一个名为 Inkscape 的工具,它允许保存到相对位置。

为此:

  1. 新建文档,创建随机铅笔路径,然后保存 SVG。关闭墨景。
  2. 在文本编辑器中编辑保存的文件。查找铅笔路径并将其替换为您的路径
  3. 在 Inkscape 中重新打开文档。找到并移动您的路径。节省。
  4. 再次编辑该文件并查找新的相对路径。

多田

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文