svgwriterΒΆ
svgwriter builds, edits and renders vector graphics in Python with a complete SVG 1.1 object model. Shapes move, rotate and scale through one transform; geometry has boolean operations and measurement; text, images and colors are first-class and numpy-backed; documents render with skia and export to PNG, PDF, TikZ, DXF, G-code, Excalidraw, icons and more.
import svgwriter as svg
doc = svg.Document()
doc.rect(0, 0, 160, 60, rx=12, fill=svg.LinearGradient.horizontal("gold", "tomato"))
title = doc.text("svgwriter", x=88, y=36, font_size=18, text_anchor="middle")
title[3:].fill = "navy"
doc += svg.paths.star(0, 0, 10, fill="navy").place(30, 30).rotate(15)
doc.save("badge.png", scale=3)
Start
Drawing
Documents & output
Motion
Explanation
Reference