The Python library for parsing, manipulating, and optimizing SVG files. Everything you need to work with SVG in Python, all in one place.
Easily parse SVG files into a structured object model and serialize them back to SVG format.
Create, edit, and delete elements and attributes programmatically.
Optimize SVG files by removing extraneous whitespace, lowering precision of floating-point numbers, and other techniques to reduce file size while preserving visual fidelity.
svglab leverages Python's type hints to provide a rich development experience with static type checking. Runtime type validation with Pydantic ensures your data is always valid.
Customize the output format of your SVG files with configurable indentation, attribute ordering, floating-point precision and 20+ other options.