Chapter 25. Using the Command Line

Table of Contents

Inkscape has the ability to batch process SVG files without opening up the Graphics User Interface (GUI). The available options can be divided into a few categories: general commands, exporting commands (including printing), and query commands. Inkscape will also open PDF files from the command line. The first page in the PDF is imported.

Most Inkscape commands are attached to verbs. Any verb can be called from the command line with the --verb argument, allowing complex processing to take place. However, it is not possible to set parameters. A list of all verbs can be obtained using --verb-list. It does not appear possible to suppress the GUI when using the --verb argument.

Here is a simple example of opening a file, selecting an object, flipping it, and then saving the file. The Star has an id of MyStar.

inkscape --select=MyStar --verb ObjectFlipVertically --verb FileSave --verb FileClose MyStar.svg

Normal star.
The file before running the above command.
A flipped star.
The file after running the above command.

Most options have two forms: a short form preceded by one dash and a long form proceeded by two dashes. Some options take parameters that can (usually) be attached to the option with an = sign (e.g., --export-png=my.png) or separated by a space (e.g., --export-png my.png).

Inkscape has a shell mode, entered by calling Inkscape from the command line with the --shell option. There are no new capabilities using this command; it is simply to allow one to execute multiple independent commands without restarting Inkscape each time. Here is an example of exporting the MyStar.svg to a PNG:

$ inkscape --shell
Inkscape 0.48 interactive shell mode. Type 'quit' to quit.
>MyStar.svg --export-png=MyStar.png
Background RRGGBBAA: ffffff00
Area 0:0:150:150 exported to 150 x 150 pixels (90 dpi)
Bitmap saved as: MyStar.png