Converting SVG to PNG on Linux
The most straightforward way to convert SVG files to PNG is using ImageMagick or Inkscape. Both are widely available in standard repositories and handle the conversion reliably.
Using ImageMagick (convert/magick)
ImageMagick provides the magick command (the modern equivalent to the older convert utility):
magick input.svg output.png
For basic conversions, that’s all you need. To control output dimensions:
magick -density 150 input.svg -resize 800x600 output.png
The -density flag controls the DPI used during rasterization—higher values produce sharper output but larger files. -resize scales the final image.
For batch conversions across multiple files:
for file in *.svg; do
magick "$file" "${file%.svg}.png"
done
To set a specific background color (SVGs with transparent backgrounds):
magick -background white input.svg output.png
Using Inkscape
Inkscape offers more precise control and is particularly useful for complex SVGs:
inkscape input.svg --export-filename=output.png
Set explicit dimensions:
inkscape input.svg --export-filename=output.png -w 800 -h 600
The -w and -h flags specify width and height in pixels. You can also use --export-dpi to control resolution:
inkscape input.svg --export-filename=output.png --export-dpi=150
For batch processing with Inkscape:
for file in *.svg; do
inkscape "$file" --export-filename="${file%.svg}.png" -w 1024
done
Using ImageMagick with multiple quality levels
If you need several PNG versions at different resolutions:
magick input.svg -density 150 output-hires.png
magick input.svg -density 96 -resize 50% output-lores.png
Handling transparency and specific options
Preserve SVG transparency:
magick input.svg output.png
PNG transparency is preserved by default. If you need a solid background instead:
magick -background "#ffffff" input.svg output.png
Common issues
Blurry output: Increase density before resizing. Start with -density 200 or higher for vector graphics.
Text rendering problems: Some complex SVGs with embedded fonts render better through Inkscape. If ImageMagick produces poor text quality, try:
inkscape input.svg --export-filename=output.png --export-dpi=300
Memory usage on large files: ImageMagick can be memory-intensive. Limit resource usage:
magick -limit memory 512MB input.svg output.png
Which tool to choose
Use ImageMagick for simple conversions, batch processing, and when you need lightweight command-line solutions. It’s fast and handles standard SVGs well.
Use Inkscape when dealing with complex SVGs, embedded fonts, or when you need precise control over rendering. It’s heavier but more robust for edge cases.
Both tools are available in standard repositories:
# Debian/Ubuntu
sudo apt install imagemagick inkscape
# RHEL/Fedora
sudo dnf install ImageMagick inkscape
# Alpine
apk add imagemagick inkscape
Troubleshooting Common Issues
When encountering problems on Linux systems, follow a systematic approach. Check system logs first using journalctl for systemd-based distributions. Verify service status with systemctl before attempting restarts. For network issues, use ip addr and ss -tulpn to diagnose connectivity problems.
Package management issues often stem from stale caches. Run dnf clean all on Fedora or apt clean on Ubuntu before retrying failed installations. If a package has unmet dependencies, try resolving them with dnf autoremove or apt autoremove.
Related System Commands
These commands are frequently used alongside the tools discussed in this article:
- systemctl status service-name – Check if a service is running
- journalctl -u service-name -f – Follow service logs in real time
- rpm -qi package-name – Query installed package information
- dnf history – View package transaction history
- top or htop – Monitor system resource usage
Quick Verification
After applying the changes described above, verify that everything works as expected. Run the relevant commands to confirm the new configuration is active. Check system logs for any errors or warnings that might indicate problems. If something does not work as expected, review the steps carefully and consult the official documentation for your specific version.

-z -e have been deprecated
inkscape always now seem to popup a GUI window in the most recent version. No way to rund from the cli silently anymore.
Any other recommendations?
inkscape –export-type=png in1.svg in2.svg in3.svg
inkscape input.svg -w 1000 -h 1000 -o output.png
More info is (now?) provided in inkscape –help
I use Inkscape 1.2.
And author is right, Inkscape exports SVG into raster formats better than ImageMagick’s convert which is terrible with SVG.