Using xverbs

From Inkscape Wiki
Revision as of 15:27, 16 May 2017 by Dmitryz (talk | contribs) (add overview section)
Jump to navigation Jump to search


"xverbs" is an extension that is useful for some batching tasks. Inkscape have a set of actions "verbs", which is bounded to menu system. One of the interesting using of "verbs" is the --verb command line option. But the length of command line is limited and "verbs" can be applied for only one .svg file or for empty new document.

"xverbs" aims to overcome limit of MAX_PATH (with libyaml) and add some useful "xverbs" with arguments. For example "xverb-id: XFileOpen, some.svg" allow open existed document and "xverb-id: XFileSaveAs, other.svg" save it with specified name.


inkscape --xverbs=xverbs.yaml

Format of xverbs.yaml:

# only "verbose: yes" enable logging
verbose: yes

  # open document to process
  - xverb-id: XFileOpen, gfx_sources/loading_screen/sandclock_atlas.svg

  # set label for XUndoToLabel "xverb" works
  # NB: if something wrong with undo labels use "verb" EditUndo instead of XUndoLabel and XUndoToLabel at all
  - xverb-id: XUndoLabel, fresh_document

  # select element to handle
  - xverb-id: XSelectElement, top_sand

  # usual "verbs"
  - verb-id: EditInvertInAllLayers
  - verb-id: EditDelete
  - verb-id: FitCanvasToDrawing

  # save element to separated svg document
  - xverb-id: XFileSaveAs, output/thegame/linux/data/gfx/loading_screen/top_sand.svg

  # also save png preview
  - xverb-id: XFileExportPNG, output/thegame/linux/data/gfx_preview/loading_screen/top_sand.png

  # return to the fresh_state of document
  - xverb-id: XUndoToLabel, fresh_document

  # do any other handling
  # Inkscape have a lot of useful "verbs"
  - verb-id: FileQuit

List of verbs

"verbs" is developed for Inkscape menu system, so "verbs" does not have any arguments. List of Inkscape "verbs" can be found at source code:

List of xverbs

XFileSaveAs - save current document to specified filename
XFileOpen - open specified .svg filename instead of current document
XFileExportPNG - export to specified .png filename
XSelectElement - select svg element by name
XUndoLabel - set undo label
UndoToLabel - undo to specified label

Additional info

Some additional info can be found at maillist thread: