svgpathtools
A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves.
What it is and what it does
svgpathtools is a Python library for working with SVG Path elements and Bézier curves at the geometric level. It lets you parse SVG files into Path objects composed of Line, Arc, QuadraticBezier, and CubicBezier segments, then manipulate and analyze them using mathematical operations. You can compute tangents, normals, curvature, arc length, intersections, bounding boxes, and areas; convert between Bézier and polynomial forms; and smooth or split paths.
The library depends on numpy for numerical operations, svgwrite for SVG output, and optionally scipy for performance. It's useful for programmatic SVG generation, geometric analysis of vector graphics, and path manipulation tasks that would be tedious to hand-code. Coordinates are represented as complex numbers, making geometric operations natural to express.
Use it for:
- Parse an SVG file and compute geometric properties (arc length, curvature, bounding boxes) of its paths.
- Programmatically generate or modify SVG paths by constructing Path objects and converting them to SVG d-strings.
- Find intersections between SVG path segments or detect where paths cross each other.
- Smooth kinked paths or break discontinuous paths into continuous subpaths for further processing.
- Convert between SVG Bézier curves and polynomial representations for mathematical analysis or visualization.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Reads, writes, and analyzes SVG Path objects and Bézier curves, providing geometric tools to transform, intersect, and measure path elements.
Yes, if you need to work with SVG paths programmatically or perform geometric analysis on vector graphics. The library is stable (MIT, no known vulnerabilities), has low install friction, and supports modern Python. The aging maintenance status is not a blocker—the last commit is recent and the repository is active—but you should verify scipy's necessity for your use case and be aware that some functionality may not be fully tested on discontinuous paths.
Install
svgpathtools on PyPI
pip
pip install svgpathtoolsuv
uv add svgpathtoolspoetry
poetry add svgpathtoolsInstalling svgpathtools
Before you install
Low friction install with three runtime dependencies (numpy, svgwrite, scipy). The package is aging but actively maintained—last commit 2025-11-30, repository not archived, and supports current Python versions (3.8–3.13).
License in practice
MIT license (permissive) allows use in commercial and private projects with minimal restrictions; attribution required.
Quickstart
from svgpathtools import Path, CubicBezier, Line, parse_path
seg1 = CubicBezier(300+100j, 100+100j, 200+200j, 200+300j)
seg2 = Line(200+300j, 250+350j)
path = Path(seg1, seg2)
print(path.d())
Verify before relying
- Whether scipy is truly optional or required for core functionality beyond performance optimization.
- Extent of testing coverage for discontinuous Path objects (documentation notes some functionality untested on them).
- Performance characteristics when handling large or complex SVG files.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — numpy, svgwrite, scipy |
| Maintenance | aging — 257 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 828,505/month — #4,954 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: svgpathtools-1.7.2-py2.py3-none-any.whl
Keywords: svg, svg path, svg.path, bezier, parse svg path, display svg
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
svg.pathParses SVG path definitions and provides…
permissive · top 5,000 on PyPI
svgelementssvgelements parses SVG files and provides…
permissive · top 5,000 on PyPI
pyclothoidsPyclothoids provides a Python interface to…
unclear · top 15,000 on PyPI
svgwriteCreates SVG drawings programmatically by…
permissive · top 5,000 on PyPI
shapelyShapely provides Python tools for creating,…
permissive · top 1,000 on PyPI
drawsvgProgrammatically generate SVG images and…
permissive · top 5,000 on PyPI
napari-svgNapari-svg is a plugin that exports image data…
permissive · top 15,000 on PyPI
gpxpyParses, manipulates, and generates GPX files…
permissive · top 15,000 on PyPI
svglibSvglib reads SVG files and converts them to…
copyleft · top 5,000 on PyPI
gdstkGdstk is a Python module for creating and…
unclear · top 15,000 on PyPI