Last active
February 7, 2025 17:32
Convert PNG to SVG in Python. For details: https://kb.aspose.com/svg/python/convert-png-to-svg-in-python/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.svg | |
import os | |
from aspose.svg import * | |
from aspose.svg.converters import * | |
from aspose.svg.drawing import * | |
from aspose.svg.rendering.image import * | |
from aspose.svg.imagevectorization import * | |
path = "C://" | |
vectorizer = ImageVectorizer() | |
vectorizer.configuration.colors_limit = 25 | |
vectorizer.configuration.line_width = 1.5 | |
# Vectorize a photo | |
with vectorizer.vectorize(os.path.join(path, “input.png")) as document: | |
output_file = os.path.join(path, "imagetoSVG.svg") | |
document.save(output_file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment