LinuxCommandLibrary

inkscape

Create and edit vector graphics

TLDR

Open an SVG file in the Inkscape GUI

$ inkscape [path/to/file.svg]
copy

Export an SVG file into a bitmap with the default format (PNG) and the default resolution (96 DPI)
$ inkscape [path/to/file.svg] [[-o|--export-filename]] [path/to/file.png]
copy

Export an SVG file into a bitmap of 600x400 pixels (aspect ratio distortion may occur)
$ inkscape [path/to/file.svg] [[-o|--export-filename]] [path/to/file.png] [[-w|--export-width]] 600 [[-h|--export-height]] 400
copy

Export the drawing (bounding box of all objects) of an SVG file into a bitmap
$ inkscape [path/to/file.svg] [[-o|--export-filename]] [path/to/file.png] [[-D|--export-area-drawing]]
copy

Export a single object, given its ID, into a bitmap
$ inkscape [path/to/file.svg] [[-i|--export-id]] [id] [[-o|--export-filename]] [object.png]
copy

Export an SVG document to PDF, converting all texts to paths
$ inkscape [path/to/file.svg] [[-o|--export-filename]] [path/to/file.pdf] [[-T|--export-text-to-path]]
copy

Duplicate the object with id="path123", rotate the duplicate 90 degrees, save the file, and quit Inkscape
$ inkscape [path/to/file.svg] --select=path123 --verb="[EditDuplicate;ObjectRotate90;FileSave;FileQuit]"
copy

SYNOPSIS

inkscape [options] [file]

PARAMETERS

-f, --file=<filename>
    Load specified document(s)

--select=<object-id>
    Select object(s) by ID (comma-separated)

--verb=<verb-name>
    Execute verbs (GUI actions)

--query-id=<id>[,<id>]
    Query object data (x,y,w,h,etc)

--query-all
    Query data for all objects

--shell
    Enter interactive command shell

--actions=<list>
    Execute semicolon-separated actions

--export-filename=<name>
    Set output filename (used with export-do)

--export-png=<file>
    Export to PNG format

--export-pdf=<file>
    Export to PDF format

--export-plain-svg=<file>
    Export to plain SVG (no Inkscape extensions)

--export-svg=<file>
    Export to SVG format

--export-eps=<file>
    Export to EPS

--export-ps=<file>
    Export to PS

--export-emf=<file>
    Export to EMF

--export-wmf=<file>
    Export to WMF

--export-area=<area>
    Export area: drawing|page|selection|content|x,y,w,h

--export-area-drawing
    Export drawing bounds

--export-area-page
    Export page bounds

--export-area-selection
    Export selection bounds

--export-id=<id>
    Export specific object

--export-id-only
    Crop to exported object

--export-dpi=<dpi>
    Set export DPI

--export-width=<w>
    Set export width (px/in)

--export-height=<h>
    Set export height (px/in)

--export-background=<color>
    Background RGBA color

--export-background-opacity=<0-1>
    Background opacity

--export-text-to-path
    Convert text to paths

--export-ignore-filters
    Skip filter effects

--pdf-page=<n>
    Select PDF page

--without-gui
    Run headless (no GUI)

-V, --version
    Print version info

-?, --help
    Show help

--help-actions
    List available actions

--help-verbs
    List available verbs

DESCRIPTION

Inkscape is a professional, free, and open-source vector graphics editor with native SVG support. Its command-line interface enables powerful headless automation for batch processing, file conversions, object manipulation, and querying. Users can export to PNG, PDF, EPS, plain SVG, and more; query bounding boxes, IDs, and attributes; select and transform objects; execute GUI verbs or custom actions; and process multiple files without the graphical interface.

Ideal for scripts, CI/CD pipelines, servers, and integration with tools like ImageMagick. The --actions system provides a scripting language for complex workflows (e.g., open; select; rotate; export; close). Export options offer precise control over area (drawing/page/selection/object), DPI, dimensions, backgrounds, and rendering (text-to-path, ignore filters). Supports PDF input via Poppler. Verbose logging and shell mode aid debugging and interactivity.

CLI replicates most GUI features, making it suitable for production environments while minimizing dependencies.

CAVEATS

CLI requires full Inkscape install; some filters/extensions need GUI libs even headless. High memory use for complex/large SVGs. No real-time preview.

SHELL MODE EXAMPLE

inkscape --shell
file-open:doc.svg
select:MyRect
export-filename:out.png
export-do

BATCH PNG EXPORT

inkscape *.svg --export-type=png --export-filename=%f.png

QUERY DIMENSIONS

inkscape file.svg --query-id=MyPath --query-x --query-y --query-width --query-height

HISTORY

Forked from Sodipodi in 2003; CLI introduced in 0.48 (2010), actions system in 0.92 (2017), major enhancements in 1.0+ (2020) for batch/export stability.

SEE ALSO

rsvg-convert(1), convert(1), gimp(1)

Copied to clipboard