svgutils
Python SVG editor
What it is and what it does
svgutils is a Python library for programmatic SVG editing, designed primarily for scientists preparing publication-ready figures. It lets you load SVG files, scale and position them arbitrarily, add text labels and markers, and combine multiple SVGs into a single output. The package wraps lxml to handle the underlying XML manipulation, so you work with SVG elements and coordinates rather than raw XML.
Typical use involves loading one or more SVG files, arranging them on a canvas with specific dimensions and offsets, annotating them with labels or other markers, and saving the result. It's aimed at automating the tedious manual work of figure assembly in tools like Inkscape, particularly when you have many similar figures to prepare for journal submission.
Use it for:
- Combine multiple scientific plots (e.g., from matplotlib) into a single multi-panel figure with consistent layout.
- Automatically add panel labels (A, B, C) and scale bars to a set of SVG figures for publication.
- Programmatically position and scale diagram elements without opening a GUI editor.
- Generate reproducible figure layouts as part of a data analysis pipeline or Jupyter notebook.
- Batch-process SVG files to apply consistent transformations (scaling, positioning) across many figures.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
svgutils lets you programmatically edit, scale, position, and concatenate SVG files, with support for adding labels and markers to figures.
Yes, if you need to automate SVG figure assembly for scientific publications. The package is actively maintained, has low install friction, and solves a real problem for researchers. However, be aware that the latest release is from 2021 and Python version support is unclear—test it with your target Python version before relying on it in production pipelines.
Install
svgutils on PyPI
pip
pip install svgutilsuv
uv add svgutilspoetry
poetry add svgutilsInstalling svgutils
Before you install
Installation is straightforward via pip, but requires system development libraries for lxml (libxml2-dev and libxslt-dev on Debian-based systems). The package is actively maintained with recent commits.
License in practice
Distributed under the MIT license, which is permissive and imposes no restrictions on use, modification, or distribution in your own projects.
Quickstart
pip install svgutils
from svgutils.svg import SVG
fig = SVG('input.svg')
fig.scale(2.0)
fig.save('output.svg')
Requires system development libraries libxml2-dev and libxslt-dev (or equivalent) for lxml compilation on Linux; conda installation avoids this requirement.
Verify before relying
- Whether the package works reliably with modern Python versions beyond those listed in classifiers (2.7, 3.5)
- Current state of the codebase given the 2011-day gap between first and latest release
- Whether all documented features from the blog post and readthedocs are fully functional in version 0.3.4
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — lxml |
| Maintenance | actively maintained — 2,011 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 85,227/month — #13,940 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: svgutils-0.3.4-py3-none-any.whl
Tags
More Markup packages
PyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
et-xmlfileet_xmlfile writes large XML files with minimal…
permissive · top 1,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
lovelyplotsLovelyPlots provides matplotlib style sheets…
permissive · top 15,000 on PyPI
svglibSvglib reads SVG files and converts them to…
copyleft · top 5,000 on PyPI
CairoSVGCairoSVG converts SVG files to PDF, EPS, PS,…
copyleft · top 5,000 on PyPI
napari-svgNapari-svg is a plugin that exports image data…
permissive · top 15,000 on PyPI
sphinxcontrib-svg2pdfconverterConverts SVG images to PDF or PNG for Sphinx…
permissive · top 15,000 on PyPI
SciencePlotsProvides a collection of Matplotlib style…
permissive · top 15,000 on PyPI
typstCompiles Typst markup documents to PDF, PNG,…
unclear · top 15,000 on PyPI
kaleidoKaleido generates static images (PNG, SVG, PDF,…
unclear · top 5,000 on PyPI
svgwriteCreates SVG drawings programmatically by…
permissive · top 5,000 on PyPI
dash-svgProvides SVG component primitives (Svg, G,…
permissive · top 15,000 on PyPI