ksvgtopng5
Convert SVG images to PNG images
TLDR
Convert an SVG file (should be an absolute path) to PNG
SYNOPSIS
ksvgtopng5 [options] <input.svg> [<output.png>]
PARAMETERS
-h, --help
Display usage information and exit
-v, --version
Show version information and exit
--size WIDTHxHEIGHT
Set output image dimensions (e.g., 256x256)
--scale FACTOR
Scale image by factor (e.g., 2.0 for double size)
--transparent
Render with transparent background
--quality 0-100
PNG compression quality (default: 75)
DESCRIPTION
ksvgtopng5 is a command-line utility from the KDE Frameworks 5 suite, designed to convert Scalable Vector Graphics (SVG) files into Portable Network Graphics (PNG) raster images. It utilizes KDE's high-fidelity SVG rendering engine, built on Qt5, ensuring accurate reproduction of vector elements like paths, gradients, filters, and text.
This tool is ideal for scripting, batch processing, or integrating into workflows where precise KDE-style rendering is needed, such as generating thumbnails for KDE applications. Unlike generic converters, it handles complex SVG features robustly, including CSS styling and animations (rendered as static frames).
Key advantages include customizable output dimensions via scaling or fixed sizes, support for transparent backgrounds, and PNG optimization options. It's lightweight for single conversions but shines in headless environments with KDE libraries installed. Users in GNOME or other desktops may need to install kimageformats package separately.
Common use cases: icon generation, web asset preparation, and print-to-digital workflows. Output quality rivals GUI tools like Inkscape but is faster for automation. Always specify output size to match SVG viewBox for best results.
CAVEATS
Requires Qt5/KDE Frameworks; install via kimageformats5 package. Defaults to SVG intrinsic size if unspecified; complex SVGs with scripts may render partially. Not for animated SVG output.
DEPENDENCIES
Qt5Svg, KDE Frameworks 5 (kimageformats package); check with ldd $(which ksvgtopng5)
EXAMPLE USAGE
ksvgtopng5 --size 512x512 input.svg output.png
ksvgtopng5 --scale 1.5 --transparent icon.svg
HISTORY
Introduced in KDE 4.x as ksvgtopng; ksvgtopng5 variant for KDE Frameworks 5/Qt5 (2014+). Maintained in kimageformats for plugin-based SVG handling; evolved for better WebSVG/CSS support.


