February 2026
This guide shows you how to use
Inkscape's
command-line interface to convert .png and .pdf files into
.svg format. In the commands below, replace NAME with your
actual filename (without extension).
Converting a PNG to SVG works by tracing the bitmap image into vector paths. Inkscape's Trace Bitmap action handles this automatically.
inkscape NAME.png \
--actions="select-all;trace-bitmap;export-plain-svg:NAME.svg;export-do"
select-all — selects the imported raster image.trace-bitmap — runs Inkscape's autotrace to convert pixels to vector paths.export-plain-svg:NAME.svg — sets the output file.export-do — triggers the export.PDFs already contain vector data, so conversion is straightforward — Inkscape reads the PDF geometry and writes it out as SVG directly.
inkscape NAME.pdf --export-filename=NAME.svg
--pdf-page=N (e.g. --pdf-page=2 for page 2).
for f in *.png; do
inkscape "$f" \
--actions="select-all;trace-bitmap;export-plain-svg:${f%.png}.svg;export-do"
done
for f in *.pdf; do
inkscape "$f" --export-filename="${f%.pdf}.svg"
done
inkscape --version
--actions flag and --export-filename are not available in older versions.inkscape binary may not be on your PATH automatically. You can add it with:
export PATH="/Applications/Inkscape.app/Contents/MacOS:$PATH"