How to batch export from SVGs with Inkscape

Get PNG, PDF, EPS, JPEG, WebP, HEIF and more…

Rohan “HEXcube” Villoth
2 min readAug 10, 2020

When working with a lot of SVG files, it might be tiresome to export via GUI for each file. Inkscape offers some command line options to avoid repetitive stuff like this. Inkscape’s — export-filename option can output to png, ps, eps, pdf, emf, wmf and xaml formats. For exporting from all svg files in the current folder to png, try this bash command:

for file in *.svg; do inkscape "$file" --export-filename "${file%svg}png"; done

For outputting to any of the supported filetypes, replace png in the above command with the filetype you need. Note that you’ll need Inkscape 1.0 or newer installed on your system, with its command accessible from the shell. Older Inkscape versions provide commands like — export-png and — export-pdf instead. Windows users need to use a bash compatible shell, like PowerShell or the shell from some Linux distro within WSL.

To convert to other image filetypes not directly supported by Inkscape, like jpg, webp, heif, tiff, bmp, etc., you need ImageMagick. With ImageMagick installed, use this command to generate jpgs from all the pngs obtained previously:

mogrify -format jpg *.png

You can replace jpg in the above command with any of the writeable formats supported by ImageMagick. With a bit of scripts like these, designers could save a lot of time and energy. I hope you’ll find these as useful as I do. Happy image generation! 👍🏼

--

--

Rohan “HEXcube” Villoth

Cube³ the Fun!😃 I’m a web developer and UI/UX enthusiast. You can find me here too: https://HEXcube.github.io