Batch convert SVG to PNG on Windows using Inkscape

Published:

Needed to convert several SVGs to PNG, and discovered that the free Inkscape easily can be used in batch scripts.

The following batch file will convert all SVGs dropped on it to a PNG with height 48 placed next to the original SVG. More options can be found in the Inkscape manual.

@echo off
for %%f in (%*) do (
  echo %%~f
  "C:\Program Files\Inkscape\inkscape.exe" ^
    -z ^
    --export-background-opacity=0 ^
    --export-height=48 ^
    --export-png="%%~dpnf.png" ^
    --file="%%~f"
)