resvg_py

Safe Python bindings for resvg, the Rust-based SVG renderer.

PyPI version Python versions GitHub stars

Tip

New here? Start with Installation and Usage to render your first SVG in under a minute.

Features

Blazing Fast

Zero-copy Rust rendering via resvg and usvg. No Python GIL bottleneck.

Full Control

Fonts, DPI, zoom, background, CSS stylesheets, and rendering policies.

Pre-built Wheels

Ready for Linux, Windows, macOS, and Android — no Rust toolchain needed.

One Function API

Call svg_to_bytes() and get PNG bytes. That’s it.

Quick Start

import resvg_py

png_bytes = resvg_py.svg_to_bytes(
    svg_string='<svg xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" fill="#6366f1"/></svg>',
    width=200,
    height=200,
)

with open("output.png", "wb") as f:
    f.write(png_bytes)

Indices and tables