有没有人知道可以获取SVG文件并将其转换为HTML 5 SVG路径的工具?你知道吗,d="M 0 0 L 20 134 L 233 24 Z" fill="#99dd79"
部分?
我来到这里:Use Adobe Illustrator to create SVG Path using "move to" commands
但不确定。这是否意味着Illustrator可以使用任何线路并将其保存为SVG路径?
注意: 是的有inkscape,但我正在寻找渐变和掩蔽支持,如果可能的话。我希望能够利用.ai文件并使用Illustrator或Acrobat或其他东西导出它们......那里有什么东西吗?或者它是作为输出格式内置到Illustrator或Acrobat中的?
答案 0 :(得分:32)
使用文本编辑器打开SVG。如果运气好,文件将包含以下内容:
<path d="M52.52,26.064c-1.612,0-3.149,0.336-4.544,0.939L43.179,15.89c-0.122-0.283-0.337-0.484-0.58-0.637 c-0.212-0.147-0.459-0.252-0.738-0.252h-8.897c-0.743,0-1.347,0.603-1.347,1.347c0,0.742,0.604,1.345,1.347,1.345h6.823 c0.331,0.018,1.022,0.139,1.319,0.825l0.54,1.247l0,0L41.747,20c0.099,0.291,0.139,0.749-0.604,0.749H22.428 c-0.857,0-1.262-0.451-1.434-0.732l-0.11-0.221v-0.003l-0.552-1.092c0,0,0,0,0-0.001l-0.006-0.011l-0.101-0.2l-0.012-0.002 l-0.225-0.405c-0.049-0.128-0.031-0.337,0.65-0.337h2.601c0,0,1.528,0.127,1.57-1.274c0.021-0.722-0.487-1.464-1.166-1.464 c-0.68,0-9.149,0-9.149,0s-1.464-0.17-1.549,1.369c0,0.688,0.571,1.369,1.379,1.369c0.295,0,0.7-0.003,1.091-0.007 c0.512,0.014,1.389,0.121,1.677,0.679l0,0l0.117,0.219c0.287,0.564,0.751,1.473,1.313,2.574c0.04,0.078,0.083,0.166,0.126,0.246 c0.107,0.285,0.188,0.807-0.208,1.483l-2.403,4.082c-1.397-0.606-2.937-0.947-4.559-0.947c-6.329,0-11.463,5.131-11.463,11.462 S5.15,48.999,11.479,48.999c5.565,0,10.201-3.968,11.243-9.227l5.767,0.478c0.235,0.02,0.453-0.04,0.654-0.127 c0.254-0.043,0.507-0.128,0.713-0.311l13.976-12.276c0.192-0.164,0.874-0.679,1.151-0.039l0.446,1.035 c-2.659,2.099-4.372,5.343-4.372,8.995c0,6.329,5.131,11.461,11.462,11.461c6.329,0,11.464-5.132,11.464-11.461 C63.983,31.196,58.849,26.064,52.52,26.064z M11.479,46.756c-4.893,0-8.861-3.968-8.861-8.861s3.969-8.859,8.861-8.859 c1.073,0,2.098,0.201,3.051,0.551l-4.178,7.098c-0.119,0.202-0.167,0.418-0.183,0.633c-0.003,0.022-0.015,0.036-0.016,0.054 c-0.007,0.091,0.02,0.172,0.03,0.258c0.008,0.054,0.004,0.105,0.018,0.158c0.132,0.559,0.592,1,1.193,1.05l8.782,0.727 C19.397,43.655,15.802,46.756,11.479,46.756z M15.169,36.423c-0.003-0.002-0.003-0.002-0.006-0.002 c-1.326-0.109-0.482-1.621-0.436-1.704l2.224-3.78c1.801,1.418,3.037,3.515,3.32,5.908L15.169,36.423z M25.607,37.285l-2.688-0.223 c-0.144-3.521-1.87-6.626-4.493-8.629l1.085-1.842c0.938-1.593,1.756,0.001,1.756,0.001l0,0c1.772,3.48,3.65,7.169,4.745,9.331 C26.012,35.924,26.746,37.379,25.607,37.285z M43.249,24.273L30.78,35.225c0,0.002,0,0.002,0,0.002 c-1.464,1.285-2.177-0.104-2.188-0.127l-5.297-10.517l0,0c-0.471-0.936,0.41-1.062,0.805-1.073h17.926c0,0,1.232-0.012,1.354,0.267 v0.002C43.458,23.961,43.473,24.077,43.249,24.273z M52.52,46.745c-4.891,0-8.86-3.968-8.86-8.858c0-2.625,1.146-4.976,2.962-6.599 l2.232,5.174c0.421,0.977,0.871,1.061,0.978,1.065h0.023h1.674c0.9,0,0.592-0.913,0.473-1.199l-2.862-6.631 c1.043-0.43,2.184-0.672,3.381-0.672c4.891,0,8.861,3.967,8.861,8.861C61.381,42.777,57.41,46.745,52.52,46.745z" fill="#241F20"/>
d
属性 您正在寻找的内容。
答案 1 :(得分:21)
Gimp可用于将带有基元(例如rects,circle等)的SVG转换为可在HTML5中使用的单个路径。
.svg
文件,例如插画。如果现在SVG输出很乱,请不要担心,Gimp会清理它检查导入路径和合并导入的路径选项
答案 2 :(得分:16)
使用Inkscape打开svg。
Inkscape是一个svg编辑器,它有点像Illustrator,但由于它是专门为svg构建的,因此它可以更好地处理它。它是一个免费软件,可以在https://inkscape.org/en/
获得完成
所有rect / circle都已转换为路径
答案 3 :(得分:3)
(回复&#34;情况有所改善?&#34;部分问题):
不幸的是,不是真的。 Illustrator对SVG的支持一直有点摇摇欲坠,而且,在Illustrator的内部工作中,我怀疑对于Illustrator而言,我们会看到很多进步。
如果您正在寻找对Illustrator文档的DOM样式访问,您可能需要查看Hanpuku (披露#1:我是作者。披露#2 :它的研究代码,意味着有很多错误,未来的支持是不可能的)。
使用Hanpuku,您可以执行以下操作:
在脚本编辑器中,键入:
selection.attr('d', 'M 0 0 L 20 134 L 233 24 Z');
点击运行
当然,这种方法不会暴露原始路径字符串。如果您按照插件欢迎页面末尾的说明操作,则可以使用Chrome的开发人员工具编辑Illustrator文档,但是到处都会出现大量丑陋的工程(反映Illustrator文档的SVG DOM被隐藏在扩展区深处的iframe中 - 使用Chrome工具更改DOM并点击“#Illust; To Illustrator&#34;”应该仍然有效,但您可能会遇到很多问题)。
TL; DR: Illustrator使用的内部模型在很多方面与SVG截然不同,这意味着当你在两者之间进行迭代时,目前,你唯一的选择是使用以相同方式支持的功能子集。
答案 4 :(得分:1)
惊讶没人提到Illustrator的另存为&gt;格式下拉菜单&gt; .svg选项。
在.svg(xml)文件中输出包含路径(以及svg定义的其余部分)的.svg文件。
路径本身位于<path d>
。