如何将PNG图像转换为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

其他回答

这取决于您为什么要从.png转换为.svg,您可能不必经历这个麻烦。如果你不是很熟悉可用的工具,或者你不是一个专业的图形设计师,那么从。png(光栅)转换到。svg(矢量)可能会很痛苦。

如果有人向您发送了一个大的、高分辨率的文件(例如1024x1024),您可以在GIMP中将其大小调整为几乎您想要的任何大小。通常情况下,如果分辨率(每英寸像素数)太低,就会出现调整图像大小的问题。要在GIMP中纠正这个问题,您可以:

File ->打开:您的。png文件 图像->图像属性:检查分辨率和颜色空间。你需要300 ppi左右的分辨率。在大多数情况下,你希望颜色空间是RGB。 Image ->模式:设置为RGB 图像->比例图像:保持大小不变,设置和Y分辨率为300或更高。达到规模。 图像->缩放图像:分辨率现在应该是300,你现在可以调整图像到几乎任何你想要的大小。

虽然不像调整.svg文件那么简单,但如果你已经有了一个大的、高分辨率的图像,那么肯定比尝试将.png转换为.svg更容易、更快。

有一个网站,你可以上传你的图片,并看到结果。

http://vectormagic.com/home

但是如果你想下载你的svg-image,你需要注册。 (注册即可免费获得2张图片)

注意那些使用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

用adobe illustrator:

打开Adobe Illustrator。点击“文件”,选择“打开”,将. png文件加载到程序中。在将图像保存为. svg文件之前,根据需要编辑图像。点击“文件”并选择“另存为”。创建新文件名或使用现有名称。确保选择的文件类型是SVG。选择一个目录,点击“保存”保存文件。

or

在线转换器 http://image.online-convert.com/convert-to-svg

我更喜欢人工智能,因为你可以做出任何需要的改变

祝你好运

Easy

下载Inkscape(完全免费) 按照youtube上这段简短视频的说明去做

正如你将看到的,如果你想做很多其他聪明的。svg的东西,你也可以使用Inkscape。

一个非技术观察:我个人更喜欢这种方法,而不是“免费”网站提供的服务,因为除了通常需要注册之外,通过上传图像,在所有实际条件下,一个人是把图像交给网站所有者。