xxxxxxxxxx
Try using Aspose.Imaging Cloud SDK for Python. https://github.com/aspose-imaging-cloud/aspose-imaging-cloud-python
Its a free REST API offering PNG to SVG and SVG to PNG or other raster image formats conversion. Convert files with only two lines of code. Happy coding
xxxxxxxxxx
from cairosvg import svg2png
svg_code = """
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/>
<line x1="12" y1="8" x2="12" y2="12"/>
<line x1="12" y1="16" x2="12" y2="16"/>
</svg>
"""
svg2png(bytestring=svg_code,write_to='output.png')