librsvg is a
free software
Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, no ...
SVG rendering library
A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
written as part of the
GNOME
A gnome is a mythological creature and diminutive spirit in Renaissance magic and alchemy, first introduced by Paracelsus in the 16th century and later adopted by more recent authors including those of modern fantasy literature. Its characte ...
project, intended to be lightweight and portable.
The
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
command-line program rsvg-convert uses the library to turn SVG files into
raster image
upright=1, The Smiley, smiley face in the top left corner is a raster image. When enlarged, individual pixels appear as squares. Enlarging further, each pixel can be analyzed, with their colors constructed through combination of the values for ...
s.
Wikipedia
Wikipedia is a multilingual free online encyclopedia written and maintained by a community of volunteers, known as Wikipedians, through open collaboration and using a wiki-based editing system. Wikipedia is the largest and most-read refer ...
and
Wikimedia Commons
Wikimedia Commons (or simply Commons) is a media repository of free-to-use images, sounds, videos and other media. It is a project of the Wikimedia Foundation.
Files from Wikimedia Commons can be used across all of the Wikimedia projects in ...
use a version of librsvg 2.40 to render SVG as PNG.
Backends
librsvg uses two other libraries to perform tasks from reading the file to rendering to the screen:
*
libxml is used to
parse
Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term ''parsing'' comes from Lati ...
the
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
representation of an SVG file into a form that can be accessed quickly by the library.
*
cairo
Cairo ( ; ar, القاهرة, al-Qāhirah, ) is the capital of Egypt and its largest city, home to 10 million people. It is also part of the largest urban agglomeration in Africa, the Arab world and the Middle East: The Greater Cairo metro ...
is used to render the information obtained by libxml to a
block
Block or blocked may refer to:
Arts, entertainment and media Broadcasting
* Block programming, the result of a programming strategy in broadcasting
* W242BX, a radio station licensed to Greenville, South Carolina, United States known as ''96.3 ...
of
memory
Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembered, ...
.
Since v2.41.0 many parts have been rewritten in
Rust
Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH ...
.
Adoption
librsvg is developed for the GNOME desktop environment and as such is used by
GNOME Files
GNOME Files, formerly and internally known as Nautilus, is the official file manager for the GNOME desktop. Nautilus was originally developed by Eazel with many luminaries from the tech world including Andy Hertzfeld (Apple), chief architect for ...
but is also intended to be used in other software applications. As a notable example, wikis hosted by
Wikimedia
The Wikimedia Foundation, Inc., or Wikimedia for short and abbreviated as WMF, is an American 501(c)(3) nonprofit organization headquartered in San Francisco, California and registered as a charitable foundation under local laws. Best know ...
use librsvg to render SVG images.
It was once picked for these web applications because it was decidedly "fast but not very accurate", according to
MediaWiki
MediaWiki is a free and open-source wiki software. It is used on Wikipedia and almost all other Wikimedia websites, including Wiktionary, Wikimedia Commons and Wikidata; these sites define a large part of the requirement set for MediaWiki ...
.
Upon switching to the
cairo
Cairo ( ; ar, القاهرة, al-Qāhirah, ) is the capital of Egypt and its largest city, home to 10 million people. It is also part of the largest urban agglomeration in Africa, the Arab world and the Middle East: The Greater Cairo metro ...
vector rendering engine in 2005,
librsvg became more accurate and more visually pleasing. Since 2012 an independent developer published
Win32 console
Windows Console is the infrastructure for console applications in Microsoft Windows. An instance of a Windows Console has a screen buffer and an input buffer. It allows console apps to run inside a window or in hardware text mode (so as to oc ...
ports , version 2.40.20. The manual page is also available online.
Version history
Usage
On Linux with the librsvg2-bin package installed,
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
Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
,
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
, and valid SVG.
References
External links
*
Download pageLibrsvg Reference Manual*
{{GNOME
C (programming language) libraries
Free software programmed in C
Free software programmed in Rust
GNOME libraries
Graphics libraries
Scalable Vector Graphics
Software that uses Cairo (graphics)