All formats

SVG libraries

SVG libraries do one or more of 3 jobs: render SVG to pixels (rasterize to PNG or draw on a canvas), parse SVG into a tree you can inspect or change, and generate SVG from code. Rendering is the hard part: full SVG needs CSS, text layout and filters, so renderers differ a lot in coverage. resvg and librsvg have the most complete static rendering outside browsers; nothing outside a browser runs SVG scripts.

In the table, Read means the library can load (and usually render) SVG files; Write means it can create or save SVG.

Language Library Read Write Notes
C/C++ librsvg yes no GNOME renderer to Cairo (PNG, PDF), very complete, LGPL
C/C++ LunaSVG yes no small C++ renderer, DOM access, MIT
C/C++ NanoSVG yes no single header parser to Bézier paths, basic rasterizer
C# SVG.NET yes yes object model, read / modify / write, renders with System.Drawing
C# Svg.Skia yes no renders with SkiaSharp to PNG, JPEG, PDF, cross-platform
Java Apache Batik yes yes full toolkit: DOM, renderer, PNG/JPEG/PDF transcoders, SVGGraphics2D
Java JSVG yes no small, fast renderer to Graphics2D, used by IntelliJ
Java JFreeSVG no yes Graphics2D that writes SVG, GPL-3.0
Go canvas yes yes vector drawing library: SVG in, SVG/PDF/PNG out
Go oksvg yes no rasterizes SVG icons with rasterx
Go SVGo no yes generate SVG with function calls, CC BY 4.0
Python CairoSVG yes no SVG to PNG, PDF, PS with Cairo, LGPL
Python svglib yes no SVG to ReportLab drawings and PDF, no Cairo needed, LGPL
Python drawsvg no yes generate SVG and SVG animations, Jupyter display
Ruby ruby-vips yes no renders SVG with libvips + librsvg, fast thumbnails
Ruby Victor no yes build SVG with a Ruby DSL, no dependencies
Rust resvg yes yes the most complete static renderer, pure Rust; usvg parses and normalizes
Rust svg yes yes compose and parse SVG documents (no rendering)
PHP php-svg yes yes pure PHP: create, parse, edit, rasterize with GD
PHP Imagick yes no ImageMagick extension: SVG to PNG, JPEG, PDF

By language#