skillfed

svgelements

Svg Elements Parsing

svgelements v1.9.6 956.9K downloads/30d#4,645 on PyPI171
Permissive license MIT DORMANT released

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 svgelements

uv

uv add svgelements

poetry

poetry add svgelements

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Multimedia :: GraphicsTopic :: Multimedia :: Graphics :: Editors :: Vector-BasedTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

svg parsing and geometrysvg path manipulationsvg to geometric objectssvg spec compliant parservector graphics parsingsvg transformation and renderingsvg element extraction
svg-parsinggeometric-manipulationspec-compliant

More Python Modules packages