且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Python将BMP/PNG/JPEG转换为SVG文件

更新时间:2023-01-18 14:47:56

我建议对Python使用Potrace.
使用此链接: https://pypi.org/project/pypotrace/
这里是文档: https://pythonhosted.org/pypotrace/ref.html#

像这样:

I would suggest using potrace for python.
Use this link: https://pypi.org/project/pypotrace/
Here is the documentation: https://pythonhosted.org/pypotrace/ref.html#

Like This:

from potrace import Bitmap

# Initialize data, for example convert a PIL image to a numpy array
# [...]

bitmap = Bitmap(data)
path = bitmap.trace()