Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active September 20, 2024 23:21
Convert SVG to PNG in Python. For more details: https://kb.aspose.com/svg/python/convert-svg-to-png-in-python/
import aspose.svg
from aspose.svg import *
from aspose.svg.converters import *
from aspose.svg.drawing.skiasharp import *
from aspose.svg.saving import *
# Activate the Aspose.SVG.Drawing.SkiaSharp feature
Configuration.set_extension(SkiaModule())
options = ImageSaveOptions()
options.format = aspose.svg.rendering.image.ImageFormat.PNG
with SVGDocument("svg.svg") as document:
# Convert SVG to PNG
Converter.convert_svg(document, options, "SVGtoPNG.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment