Librsvg

Last updated
librsvg
Original author(s) Raph Levien
Developer(s) GNOME Project
Stable release
2.57.1 / 15 December 2023
Repository
Written in C, Rust
Type Graphics library
License GPLv2, LGPLv2
Website wiki.gnome.org/Projects/LibRsvg   OOjs UI icon edit-ltr-progressive.svg

librsvg, (occasionally stylized as LibRsvg) [1] is a free software SVG rendering library written as part of the GNOME project, intended to be lightweight and portable. [2] The Linux command-line program rsvg-convert uses the library to turn SVG files into raster images.

Contents

Backends

librsvg uses two other libraries to perform tasks from reading the file to rendering to the screen:

Since v2.41.0 many parts have been rewritten in Rust. [3] [4]

Adoption

librsvg is developed for the GNOME desktop environment and as such is used by GNOME Files and GNOME Loupe but is also intended to be used in other software applications. As a notable example, wikis hosted by Wikimedia use librsvg to render SVG images. [5] It was once picked for these web applications because it was decidedly "fast but not very accurate", according to MediaWiki. [6] As of May 2023, Wikipedia and Wikimedia Commons use a version of librsvg 2.44 to render SVG as PNG. [7] [8]

Upon switching to the cairo vector rendering engine in 2005, [9] [10] librsvg became more accurate and more visually pleasing. Since 2012 an independent developer published Win32 console ports rsvg-convert.exe, as of December 2017 version 2.40.20. [11] The rsvg-view manual page is also available online. [12]

Version history

VersionDateComments
1.0.02001-05-08
1.1.62002-03-07
2.0.02002-06-19
2.1.02002-09-27
2.2.02003-01-20
2.3.02003-04-08
2.4.02003-09-08
2.5.02003-12-07
2.6.02004-03-08
2.7.02004-03-10
2.8.02004-09-03
2.9.02005-01-25
2.11.02005-08-25
2.12.02005-09-15
2.13.02005-10-21
2.14.02006-02-25
2.15.02006-05-11
2.16.02006-08-31
2.18.02007-07-24
2.20.02008-01-19
2.22.02008-02-21
2.26.02009-03-16
2.31.02010-07-02
2.32.02010-09-27
2.34.02011-04-03
2.35.02011-11-14
2.36.02012-03-26
2.37.02013-01-10
2.39.02013-08-16
2.40.02013-10-14
2.40.162016-06-09
2.40.172017-04-07
2.40.202017-12-16
2.40.212020-02-262.40.21: Last version without Rust
2.41.02017-01-04
2.42.02018-01-09
2.43.02018-06-12
2.44.02018-08-23
2.44.102018-12-11Older version, yet still maintained: 2.44.10: version used on Wikimedia Commons as of May 2023 [13]
2.45.02018-11-17
2.45.62019-05-142:45.6: First version only on Rust.[ clarification needed ] Requires Cairo 1.16.0 or later and Rust 1.30.0 or later [14]
2.45.922019-09-02
2.46.02019-09-09
2.47.02019-10-29
2.48.02020-03-07
2.48.92020-11-05
2.49.02020-05-29
2.49.52020-09-04
2.50.02020-09-10
2.50.32021-01-28
2.51.02021-02-03
2.51.42021-07-09
2.52.02021-09-15
2.53.02022-01-18
2.53.12022-02-12
2.53.22022-03-12
2.54.02022-03-162.54.1 2022-04-23; 2.54.2 2022-05-13; 2.54.3 2022-05-14; 2.54.4 2022-06-10; 2.54.5 2022-08-26
2.55.02022-08-03
2.55.12022-09-05
2.55.22023-03-16
2.57.902024-01-25Latest version as of 2024-01-25

First version to use Rust crates for all image loading operations, eliminating gdk-pixbuf dependency. [15]

Usage

On Linux with the librsvg2-bin package installed, [16] an SVG file can be converted to PNG as follows:

$rsvg-convert--format=png--output=diagram.pngdiagram.svg 

Other supported output formats include PDF, XML, and valid SVG.

Related Research Articles

Multiple-image Network Graphics (MNG) is a graphics file format published in 2001 for animated images. Its specification is publicly documented and there are free software reference implementations available.

Scalable Vector Graphics (SVG) is an XML-based vector image format for defining two-dimensional graphics, having support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium since 1999.

<span class="mw-page-title-main">Vector graphics</span> Computer graphics images defined by points, lines and curves

Vector graphics are a form of computer graphics in which visual images are created directly from geometric shapes defined on a Cartesian plane, such as points, lines, curves and polygons. The associated mechanisms may include vector display and printing hardware, vector data models and file formats, as well as the software based on these data models. Vector graphics is an alternative to raster or bitmap graphics, with each having advantages and disadvantages in specific situations.

XSLT is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG. Support for JSON and plain-text transformation was added in later updates to the XSLT 1.0 specification.

<span class="mw-page-title-main">GNUstep</span> Open source widget toolkit and application development tools

GNUstep is a free software implementation of the Cocoa Objective-C frameworks, widget toolkit, and application development tools for Unix-like operating systems and Microsoft Windows. It is part of the GNU Project.

<span class="mw-page-title-main">Inkscape</span> Free open-source vector graphics editor

Inkscape is a free and open-source vector graphics editor for traditional Unix-compatible systems such as GNU/Linux, BSD derivatives and Illumos, as well as Windows and macOS. It offers a rich set of features and is widely used for both artistic and technical illustrations such as cartoons, clip art, logos, typography, diagramming and flowcharting. It uses vector graphics to allow for sharp printouts and renderings at unlimited resolution and is not bound to a fixed number of pixels like raster graphics. Inkscape uses the standardized Scalable Vector Graphics (SVG) file format as its main format, which is supported by many other applications including web browsers. It can import and export various other file formats, including SVG, AI, EPS, PDF, PS and PNG.

Formatting Objects Processor is a Java application that converts XSL Formatting Objects (XSL-FO) files to PDF or other printable formats. FOP was originally developed by James Tauber who donated it to the Apache Software Foundation in 1999. It is part of the Apache XML Graphics project.

<span class="mw-page-title-main">Glade Interface Designer</span> Graphical user interface builder

Glade Interface Designer is a graphical user interface builder for GTK, with additional components for GNOME. In its third version, Glade is programming language–independent, and does not produce code for events, but rather an XML file that is then used with an appropriate binding. See List of language bindings for GTK for the available ones.

Cairo (graphics) Vector graphics-based software library

Cairo is an open-source graphics library that provides a vector graphics-based, device-independent API for software developers. It provides primitives for two-dimensional drawing across a number of different back ends. Cairo uses hardware acceleration when available.

<span class="mw-page-title-main">GDK</span> Software library

GDK is a library that acts as a wrapper around the low-level functions provided by the underlying windowing and graphics systems. GDK lies between the display server and the GTK library, handling basic rendering such as drawing primitives, raster graphics (bitmaps), cursors, fonts, as well as window events and drag-and-drop functionality.

A number of vector graphics editors exist for various platforms. Potential users of these editors will make a comparison of vector graphics editors based on factors such as the availability for the user's platform, the software license, the feature set, the merits of the user interface (UI) and the focus of the program. Some programs are more suitable for artistic work while others are better for technical drawings. Another important factor is the application's support of various vector and bitmap image formats for import and export.

libxml2 is a software library for parsing XML documents. It is also the basis for the libxslt library which processes XSLT-1.0 stylesheets.

<span class="mw-page-title-main">Poppler (software)</span> Free library for creating PDF documents

Poppler is a free software utility library for rendering Portable Document Format (PDF) documents. Its development is supported by freedesktop.org. It is commonly used on Linux systems, and is used by the PDF viewers of the open source GNOME and KDE desktop environments.

<span class="mw-page-title-main">Synfig</span>

Synfig Studio is a free and open-source vector-based 2D animation software. It is created by Robert Quattlebaum with additional contributions by Adrian Bentley.

Libart is a free software graphics library of functions for 2D graphics supporting a superset of the PostScript imaging model. Libart was designed to be integrated with graphics, artwork, and illustration programs. It is written in optimized C and is fully compatible with C++. With a small footprint of 10,000 lines of code, it is especially suitable for embedded applications.

<span class="mw-page-title-main">Wayland (protocol)</span> Display system intended to replace X11

Wayland is a communication protocol that specifies the communication between a display server and its clients, as well as a C library implementation of that protocol. A display server using the Wayland protocol is called a Wayland compositor, because it additionally performs the task of a compositing window manager.

Mapnik is an open-source mapping toolkit for desktop and server based map rendering, written in C++. Artem Pavlenko, the original developer of Mapnik, set out with the explicit goal of creating beautiful maps by employing the sub-pixel anti-aliasing of the Anti-Grain Geometry (AGG) library. Mapnik now also has a Cairo rendering backend. For handling common software tasks such as memory management, file system access, regular expressions, and XML parsing, Mapnik utilizes the Boost C++ libraries. An XML file can be used to define a collection of mapping objects that determine the appearance of a map, or objects can be constructed programmatically in C++, Python, and Node.js.

<span class="mw-page-title-main">GTK</span> Free and open-source cross-platform widget toolkit for creating graphical user interfaces

GTK is a free software cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the Wayland and X11 windowing systems.

Xena is open-source software for use in digital preservation. Xena is short for XML Electronic Normalising for Archives.

<span class="mw-page-title-main">GTK Scene Graph Kit</span>

GTK Scene Graph Kit (GSK) is the rendering and scene graph API for GTK introduced with version 3.90. GSK lies between the graphical control elements (widgets) and the rendering.

References

  1. "Projects/LibRsvg - GNOME Wiki!".
  2. "librsvg is a library to render SVG files using cairo". librsvg. GNOME. Retrieved May 10, 2012.
  3. "Librsvg 2.41.0 is released". mail.gnome.org. 2017-01-03. Retrieved 2018-11-20.
  4. Quintero, Federico Mena (2017). Replacing C library code with Rust: What I learned with librsvg (PDF). Manchester, UK: GUADEC. Archived from the original (PDF) on 2017-09-28. Retrieved 2018-11-20.
  5. Lucideer (April 27, 2009). "Manual:Image Administration - MediaWiki". MediaWiki. Retrieved April 6, 2011.
  6. "SVG benchmarks - MediaWiki". MediaWiki. Retrieved April 6, 2011.
  7. "Update librsvg to ≥2.42.3 (2.44.10)". Wikimedia Phabricator . Retrieved 2023-11-22.
  8. "librsvg bugs". Wikimedia Commons. Retrieved 2023-11-22.
  9. Worth, Carl (2 September 2005). "svg shootout". gmane.comp.gnome.lib.librsvg.devel. Retrieved 29 November 2014. the librsvg maintainers … have now added cairo support to librsvg. Many thanks are due to Caleb Moore and Dom Lachowicz for this work. The source can be compiled --with-cairo and it builds separate librsvg-2-cairo.so and librsvg-2-base.so libraries
  10. Moore, Caleb (3 November 2005). "using librsvg cairo". gmane.comp.gnome.lib.librsvg.devel. Retrieved 29 November 2014. Librsvg-2.13 cannot link to libart since that backend was majorly broken when we released 2.13 and thus must link to cairo.
  11. TumaGonx Zakkum (2012-06-10). "RSVG-Convert SVG image conversion tool". Open Source Software and Windows 32-bit. Retrieved 2017-01-31.
  12. Paul Brossier; Dom Lachowicz; Alex Larsson; et al. "rsvg-view" (man page). Archived from the original on 2014-12-28. Retrieved 2014-12-28.
  13. "⚓ T193352 Update librsvg to ≥2.42.3 (2.44.10)". phabricator.wikimedia.org. Retrieved 2024-01-26.
  14. https://download.gnome.org/sources/librsvg/2.45/librsvg-2.45.6.news
  15. https://download.gnome.org/sources/librsvg/2.57/librsvg-2.57.90.news
  16. "Debian -- Details of package librsvg2-bin in buster".