The rsvg-convert is a command-line utility provided by the librsvg project for converting SVG files into raster image formats such as PNG. It offers reliable SVG rendering and is commonly used in scripts, automation tasks, and image processing workflows. This tutorial explains how to install rsvg-convert on Ubuntu 26.04.
Install rsvg-convert
Refresh the package index before installing the required package:
sudo apt update
Install the librsvg2-bin package, which includes the rsvg-convert utility:
sudo apt install -y librsvg2-bin
Verify that the rsvg-convert is installed correctly by displaying its version:
rsvg-convert --version
Testing rsvg-convert
Create a sample SVG file:
nano test.svg
Insert the following SVG markup into the file:
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" fill="orange"/>
</svg>
Convert the SVG file into a PNG image:
rsvg-convert -o test.png test.svg
When the command completes, a file named test.png will be created in the current directory.
Uninstall rsvg-convert
If the rsvg-convert is no longer required, remove the package along with any unused dependencies:
sudo apt purge --autoremove -y librsvg2-bin
Leave a Comment
Cancel reply