SVG libraries for Ruby
Two libraries cover most needs:
- ruby-vips is the binding to libvips, which renders SVG with librsvg. Use it to convert SVG to PNG, JPEG, WebP or AVIF, or to make thumbnails: it’s fast and uses little memory. Needs libvips built with SVG support. It’s the backend of Rails’ Active Storage image processing.
- Victor builds SVG documents with a small Ruby DSL: each method call becomes an SVG element. No dependencies.
MiniMagick (ImageMagick) and the rsvg2 gem from Ruby-GNOME can also rasterize SVG.
- ruby-vips ruby-vips renders SVG with libvips and librsvg in Ruby. How to install it, convert SVG to PNG, render at a DPI or scale, make thumbnails of SVG files.
- Victor Victor is a Ruby gem that builds SVG images with a small DSL and no dependencies. How to install it, draw shapes and text, nest groups, add CSS.