svgelements
Svg Elements Parsing
What it is and what it does
svgelements is a Python library that parses SVG files according to the SVG specification and exposes their geometry as manipulable Python objects. It provides classes for SVG elements like Path, Matrix, Color, Point, and shapes (Rect, Circle, Ellipse, Polygon, Line), along with transformation and rendering capabilities. The library was originally developed for meerK40t (a laser-cutting application) and aims to handle edge cases that simpler SVG parsers miss.
The package has no hard dependencies and can be used as a single-file module. It supports SVG/CSS lengths (px, pt, cm, mm, in, %), colors (keywords, hex, rgb, rgba, hsl), transformations, viewports, clipping paths, and groups. Optional soft dependencies (scipy for arc length, Pillow for image loading, numpy for fast linearization) enhance specific features. It does not currently support gradients, masks, markers, or full CSS stylesheets.
Use it for:
- Parse SVG files for laser-cutting or CNC machine control applications, extracting geometric data for toolpath generation.
- Convert SVG shapes to Path objects and apply affine transformations (rotation, scaling, translation) for graphics manipulation.
- Extract and manipulate SVG colors, angles, and lengths using robust spec-compliant parsing to avoid edge cases.
- Build SVG analysis or transcoding tools that need to read, validate, and modify SVG content programmatically.
- Integrate SVG geometry into custom graphics pipelines by converting SVG elements to your own internal data structures.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
svgelements parses SVG files and provides geometric objects (Path, Matrix, Color, Point, etc.) that conform to the SVG specification, enabling robust manipulation of SVG data as geometric structures.
Yes, if you need robust SVG parsing with geometric manipulation. The library is stable (Production/Stable, no known vulnerabilities) and has low install friction. However, it is dormant—last release was 2023-08-17—so expect no active maintenance. Use it for parsing and geometric operations, but do not rely on it for new SVG 2.0 features or rapid bug fixes. Suitable for established projects with stable SVG workflows.
Install
svgelements on PyPI
pip
pip install svgelementsuv
uv add svgelementspoetry
poetry add svgelementsInstalling svgelements
Before you install
Installation is straightforward with no hard dependencies. The package is dormant (last release 2023-08-17, last commit 2024-10-17), but remains in Production/Stable status with 171 repository stars. Soft dependencies (scipy, Pillow, numpy) are optional and enhance specific features.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute the code freely as long as you include the original license notice.
Quickstart
pip install svgelements
from svgelements import SVG, Path, Color, Matrix
# Parse an SVG file
svg = SVG.parse('file.svg')
# Access and manipulate elements
for shape in svg.shapes():
print(shape.fill, shape.stroke_width)
Verify before relying
- Whether soft dependencies (scipy, Pillow, numpy) are automatically detected and used when available, or require explicit configuration.
- Current state of backwards compatibility with svg.path library, given the project is dormant.
- Whether the package handles modern SVG 2.0 features beyond the stated SVG 1.1 conformance.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,093 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 956,872/month — #4,645 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: svgelements-1.9.6-py2.py3-none-any.whl
Keywords: svg, path, elements, matrix, vector, parser
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
svg.pathParses SVG path definitions and provides…
permissive · top 5,000 on PyPI
ocpsvgConverts between SVG path strings and…
unclear · top 15,000 on PyPI
svgpathtoolsReads, writes, and analyzes SVG Path objects…
permissive · top 5,000 on PyPI
svglibSvglib reads SVG files and converts them to…
copyleft · top 5,000 on PyPI
scourScour optimizes and cleans SVG files by…
permissive · top 15,000 on PyPI
drawsvgProgrammatically generate SVG images and…
permissive · top 5,000 on PyPI
dash-svgProvides SVG component primitives (Svg, G,…
permissive · top 15,000 on PyPI
svg.pyGenerates SVG files programmatically in Python…
permissive · top 15,000 on PyPI
svgwriteCreates SVG drawings programmatically by…
permissive · top 5,000 on PyPI
Geode-ConversionProvides conversion functionality for the…
unclear · top 15,000 on PyPI