rsvg2 provides Ruby bindings to librsvg, the GNOME library for rendering SVG (Scalable Vector Graphics) images. librsvg handles parsing SVG files and rendering them to various output surfaces with support for most SVG 1.1 features. The gem enables Ruby applications to load, render, and manipulate SVG images, converting vector graphics to raster formats or displaying them in GTK applications.
The library supports loading SVG from files or memory, rendering to Cairo surfaces at arbitrary resolutions without quality loss, and extracting SVG elements by ID for partial rendering. It handles SVG features including paths, gradients, filters, text, transformations, and embedded images, with support for CSS styling and animations. rsvg2 integrates with the ruby-gnome ecosystem, particularly cairo for rendering operations, allowing SVG rendering to images, PDFs, or screen display. The gem provides dimension queries, DPI control for output resolution, and handles SVG viewBox and aspect ratio preservation.
rsvg2 is essential for Ruby applications rendering icons or illustrations from SVG sources, image conversion tools supporting SVG input, and GTK applications displaying vector graphics. It's used in web application backends converting SVG to raster formats, icon processing pipelines, diagram generators, and any system requiring high-quality scalable graphics rendering. The gem's ability to render SVG at any resolution makes it valuable for generating thumbnails, print-quality images, or responsive graphics from a single SVG source, common in modern web and desktop applications.
gem install rsvg2 Run this gem instantly in your browser without any installation:
Open in RunRuby.dev →All 126 versions available for installation