Inkscape - Command line to convert SVG to PNG

By xngo on June 17, 2019

Since you already have Inkscape installed to draw your SVGs, then it would be convenient to use it as a command line tool to export your SVGs to PNG files. Here are some examples. But, before, you run the command line, make sure to close all Inkscape instances. Otherwise, it will use the GUI. It will defeat the purpose of the command line.

# Export SVG to PNG.
inkscape --without-gui INPUT.svg -w 32 -h 32 -o OUTPUT.png
 
# Export SVG to PDF.
inkscape --without-gui INPUT.svg -w 32 -h 32 -o OUTPUT.pdf
  • -w: Export width in pixels.
  • -h: Export height in pixels.
  • -o: Output filename.

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.