talira

An SVG rendering library

open sourceApache-2.0 OR MITself-hostablefree

resvg renders static SVG files to images, written entirely in Rust with almost no unsafe code. Parsing and rendering are separate: usvg turns an SVG into a simplified tree (resolving CSS, text layout with its own font database and nested images) and resvg rasterises that tree with tiny-skia, so a program can bring its own renderer. It runs as a Rust library, a C library or a CLI, works anywhere Rust compiles including WASM, and has a regression suite of around 1,600 SVG-to-PNG tests. Animations and scripting aren't supported.

Ways to install

Problems it solves

  • generate Open Graph link preview images for every page of my site on the server
  • turn an SVG string into a PNG in my Rust backend without shelling out to Inkscape or a headless browser
  • render social share cards with our own font so they look the same on every machine
  • rasterise SVG icons and logos to PNG at build time
  • librsvg pulls in GLib and Cairo and I want a pure Rust SVG renderer
  • render SVGs in a WASM app without a browser canvas
  • lay out text in an SVG with a font I bundle instead of whatever fonts the server has
  • make thumbnails of user-uploaded SVG files safely without running scripts in them
  • draw charts as SVG and export them as PNG from a CLI

Features

  • SVG to PNG rendering
  • text layout with a bundled font database (fontdb) and variable fonts
  • nested SVG and raster images
  • separate parser (usvg) and renderer
  • C API
  • CLI
  • WASM support

Capabilities

Has a command line toolplan not known
Has official SDKsplan not known

Alternatives

The same job

These do what resvg does.

  1. Inkscape Draw Freely

Compare resvg with the top 3