Librsvg

librsvg

librsvg

SVG rendering library


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

Quick Facts Original author(s), Developer(s) ...

Backends

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

  • libxml is used to parse the XML representation of an SVG file into a form that can be accessed quickly by the library.
  • cairo is used to render the information obtained by libxml to a block of memory.

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

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.[6] It was once picked for these web applications because it was decidedly "fast but not very accurate", according to MediaWiki.[7] As of May 2023, Wikipedia and Wikimedia Commons use a version of librsvg 2.44 to render SVG as PNG.[8][9]

Upon switching to the cairo vector rendering engine in 2005,[10][11] 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.[12] The rsvg-view manual page is also available online.[13]

Version history

More information Version, Date ...

Usage

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

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

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


References

  1. "2.58.0 - stable".
  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. "librsvg bugs". Wikimedia Commons. Retrieved 2023-11-22.
  8. 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
  9. 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.
  10. TumaGonx Zakkum (2012-06-10). "RSVG-Convert SVG image conversion tool". Open Source Software and Windows 32-bit. Retrieved 2017-01-31.
  11. Paul Brossier; Dom Lachowicz; Alex Larsson; et al. "rsvg-view" (man page). Archived from the original on 2014-12-28. Retrieved 2014-12-28.
  12. "⚓ T193352 Update librsvg to ≥2.42.3 (2.44.10)". phabricator.wikimedia.org. Retrieved 2024-01-26.

Share this article:

This article uses material from the Wikipedia article Librsvg, and is written by contributors. Text is available under a CC BY-SA 4.0 International License; additional terms may apply. Images, videos and audio are available under their respective licenses.