7 releases (breaking)

0.6.1 Mar 16, 2019
0.6.0 Mar 15, 2019
0.5.0 Jan 4, 2019
0.4.0 Dec 14, 2018
0.1.0 Dec 18, 2017

#9 in Images

Download history 35/week @ 2019-01-20 35/week @ 2019-01-27 15/week @ 2019-02-03 26/week @ 2019-02-10 14/week @ 2019-02-17 20/week @ 2019-02-24 24/week @ 2019-03-03 24/week @ 2019-03-10 12/week @ 2019-03-17 29/week @ 2019-03-24 4/week @ 2019-03-31 12/week @ 2019-04-07 18/week @ 2019-04-14 17/week @ 2019-04-21 96/week @ 2019-04-28

100 downloads per month

MPL-2.0 license

12K SLoC


Build Status Crates.io Documentation

resvg is an SVG rendering library.


resvg can be used as:

to render SVG files based on a static SVG Full 1.1 subset (see SVG support for details).

The core idea is to make a fast, small, portable, multiple backend SVG library designed for edge-cases.

SVG can be rendered to a raster image or to a backend's canvas (e.g. to a QWidget via QPainter).

Why a new library?

resvg is trying to compete with librsvg, QtSvg and Inkscape (only as a CLI SVG to PNG converter).

One of the major differences from other rendering libraries is that resvg does a lot of preprocessing before rendering. It converts shapes to paths, resolves attributes, removes groups and invisible elements, fixes a lot of issues in malformed SVG files. Then it creates a simple render tree with all elements and attributes resolved. And only then it starts to render. So it's very easy to implement a new rendering backend.

More details here.

resvg vs librsvg

librsvg is the main competitor to the resvg. And even though that librsvg itself is being rewritten in Rust, as resvg, the architecture of the library is completely different:

  • librsvg, currently, is heavily tied to the cairo library, unlike resvg
  • librsvg is heavily tied to GNOME which makes it painful to distribute outside the Linux ecosystem
  • librsvg doesn't really preprocess input files, rendering them as is
  • librsvg has a minimal support of the edge-cases, which leads to rendering errors

resvg vs Inkscape

Inkscape is often used to convert SVG to PNG, but it's not an actual competitor to resvg, since it's still a complete vector editor, not a tiny library. Also, it's very slow. But it has the best SVG support amongst others.

resvg vs QtSvg

Without a doubt, QtSvg is heavily used in Qt applications. But QtSvg itself is very limited. It officially supports only a tiny portion of the SVG Tiny 1.2 subset. In simple terms - it correctly renders only primitive SVG images.

SVG support

resvg is aiming to support only the static SVG subset. E.g. no a, script, view, cursor elements, no events and no animations.

Also, textPath and embedded fonts are not yet implemented. A full list can be found here.

SVG Tiny 1.2 and SVG 2.0 are not supported and not planned.

Results of the static subset of the SVG test suite:


Results of the resvg test suite:


You can find a complete table of supported features here. It also includes alternative libraries.


Note that all tested applications have a different SVG support, which impacts the performance.

Also, we do not test against Chrome, Firefox, Inkscape and Batik because they have a huge startup time.


  • Elementary Icon Theme contains 3417 files.
  • Qt backend is slow because QRasterPaintEngine is slow.


  • Oxygen Icon Theme contains 4947 files.
  • All images were converted from .svgz to .svg beforehand.
  • resvg is slower than librsvg because Oxygen Icon Theme is using Gaussian blur heavily, which is expensive. And librsvg uses box blur optimization and multithreading, while resvg always uses a single-threaded IIR blur (at least for now).
  • QtSvg doesn't support filter, clipPath, mask and pattern that are heavily used in the Oxygen Icon Theme. So it's actually very slow.

Project structure

  • resvg - rendering backends implementation

All other dependencies aren't written by me for this project.

Directory structure

  • capi - C/FFI interface for resvg
  • docs - basic documentation
  • examples - resvg as a library usage examples
  • resvg-qt - a minimal bindings to Qt used by resvg
  • src - source code
  • testing_tools - scripts used for testing
  • tools - useful tools
  • usvg - an SVG simplification library used by resvg


  • The library must not panic. Any panic should be considered a critical bug and reported. There are only few methods that can produce a panic.
  • The core library structure (see above) does not use any unsafe, but since all backends are implemented via FFI, we are stuck with unsafe anyway.


resvg is licensed under the MPLv2.0.


~73K SLoC