如何将PNG图像转换为SVG?
当前回答
这取决于您为什么要从.png转换为.svg,您可能不必经历这个麻烦。如果你不是很熟悉可用的工具,或者你不是一个专业的图形设计师,那么从。png(光栅)转换到。svg(矢量)可能会很痛苦。
如果有人向您发送了一个大的、高分辨率的文件(例如1024x1024),您可以在GIMP中将其大小调整为几乎您想要的任何大小。通常情况下,如果分辨率(每英寸像素数)太低,就会出现调整图像大小的问题。要在GIMP中纠正这个问题,您可以:
File ->打开:您的。png文件 图像->图像属性:检查分辨率和颜色空间。你需要300 ppi左右的分辨率。在大多数情况下,你希望颜色空间是RGB。 Image ->模式:设置为RGB 图像->比例图像:保持大小不变,设置和Y分辨率为300或更高。达到规模。 图像->缩放图像:分辨率现在应该是300,你现在可以调整图像到几乎任何你想要的大小。
虽然不像调整.svg文件那么简单,但如果你已经有了一个大的、高分辨率的图像,那么肯定比尝试将.png转换为.svg更容易、更快。
其他回答
你也可以试试http://image.online-convert.com/convert-to-svg
我总是用它来满足我的需要。
I'm assuming that you wish to write software to do this. To do it naively you would just find lines and set the vectors. To do it intelligently, you attempt to fit shapes onto the drawing (model fitting). Additionally, you should attempt to ascertain bitmaped regions (regions you can't model through shames or applying textures. I would not recommend going this route as that it will take quite a bit of time and require a bit of graphics and computer vision knowledge. However, the output will much and scale much better than your original output.
如果你使用的是Linux系统,imagemagick是完美的。即
convert somefile.png somefile.svg
这适用于大量不同的格式。
用于其他媒体,如视频和音频使用(ffmpeg) 我知道你清楚地说明png到svg,然而;这仍然与媒体有关。
ffmpeg -i somefile.mp3 somefile.ogg
如果你想浏览大量的文件,这是一个小技巧;一个循环使用基本的shell技巧。
for f in *.jpg; do convert $f ${f%jpg}png; done
这将删除jpg并添加png,这告诉转换你想要的。
http://online-converting.com/image/convert-to-svg/可以很好地转换为SVG
有一个网站,你可以上传你的图片,并看到结果。
http://vectormagic.com/home
但是如果你想下载你的svg-image,你需要注册。 (注册即可免费获得2张图片)