Inkscape command line programming

If what you want to do can be achieved by deleting a few unwanted elements by their id (say, layer17 and layer4711), you can do it this way:

inkscape image.svg \
  --select=layer17   --verb=EditDelete \
  --select=layer4711 --verb=EditDelete \
  --verb=FileSave --verb=FileClose

Note that this will overwrite image.svg with the result, so if you're scripting this, be sure to work on a copy rather than your originals.


inkscape image.svg --export-id-only --export-id=layer17 --export-png=image.png --export-width=100 --export-height=100

On a Mac you might have to do:

/Applications/Inkscape.app/Contents/Resources/bin/inkscape --without-gui --file=image.svg --export-id-only --export-id=layer17 --export-png=image.png --export-width=100 --export-height=100