如何将PNG图像转换为SVG?
当前回答
你可能想看看potrace。
其他回答
Easy
下载Inkscape(完全免费) 按照youtube上这段简短视频的说明去做
正如你将看到的,如果你想做很多其他聪明的。svg的东西,你也可以使用Inkscape。
一个非技术观察:我个人更喜欢这种方法,而不是“免费”网站提供的服务,因为除了通常需要注册之外,通过上传图像,在所有实际条件下,一个人是把图像交给网站所有者。
png是位图图像风格,SVG是支持位图的基于矢量的图形设计,因此它不会将图像转换为矢量,只是将图像嵌入到基于矢量的格式中。你可以使用免费的http://www.inkscape.org/来实现。它会嵌入它,但是它也有一个Live Trace之类的引擎,如果你愿意,它会尝试将它转换为路径(使用potrace)。查看adobe illustrator中的实时跟踪(商业)是一个例子:
http://graphicssoft.about.com/od/illustrator/ss/sflivetrace.htm
这个工具现在工作得很好。
http://www.mobilefish.com/services/image2svg/image2svg.php
http://online-converting.com/image/convert-to-svg/可以很好地转换为SVG
注意那些使用potrace和imagemagick的人,将透明的PNG图像转换为PPM似乎不是很好。下面是一个在convert上使用-flatten标志来处理这个问题的例子:
sudo apt-get install potrace imagemagick
convert -flatten input.png output.ppm
potrace -s output.ppm -o output.svg
rm output.ppm
Another interesting phenomenon is that you can use PPM (256*3 colors, ie. RGB), PGM (256 colors, ie. grayscale) or PBM (2 colors, ie. white or black only) as the input format. From my limited observations, it would appear that on images which are anti-aliased, PPM and PGM (which produce identical SVGs as far as I can see) shrink the colored area and PBM expands the colored area (albeit only a little). Presumably this is the difference between a pixel > (256 / 2) test and a pixel > 0 test. You can switch between the three by changing the file extension, ie. the following use PBM:
sudo apt-get install potrace imagemagick
convert -flatten input.png output.pbm
potrace -s output.pbm -o output.svg
rm output.pbm