Inkscape.org
Beginners' Questions How to see what INKSCAPE command is getting executed when am performing an action in the GUI
  1. #1
    Sayad Pervez Sayad Pervez @sayadpervez

    Am a programmer trying to implement a certain action on a SVG image using INKSCAPE Command Line. I tried using the inkscape --verb-list and inkscape --action-list commands and yet found no command satisfying my needs. However I know how to perform the required action using the INKSCAPE GUI. So, is there a way I can see all the equivalent commands for everything I do in the GUI.

    Thanks in Advance

  2. #2
    inklinea inklinea @inklinea⛰️

    Can you describe what you want to do ? 

    Myself and others on here do use the command line often, maybe it is possible.

     

  3. #3
    Sayad Pervez Sayad Pervez @sayadpervez

    Am trying to resize canvas to drawing. I tried running inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose --verb=FileQuit foo.svg command. But when I open the SVG again I see no change. 

    A solution to the above problem would be greatly helpful. I would also appreciate if you help me locate a log file where recently executed commands for the corresponding GUI actions are stored so that I don't have to go through a long list of commands in my terminal again.

    Thanks in Advance

  4. #4
    inklinea inklinea @inklinea⛰️
    👍

    ** Assuming you are using Inkscape 1.1+ **

    It isn't necessary to use --verb at all.

    Everything can be done with this format:

    inkscape --myoption1 --myoption2 and --actions="myaction1;myaction2"

    action and verbs are placed in the --actions="xxxxx" section separated by semicolons ; and if the verb or action uses a parameter it follows the verb or action with a colon :

    The difference between verbs and actions, is that most actions do not require the gui to be triggered in the background, whereas most verbs do.

    This means that using purely actions is faster, and if you use a verb at all, you cannot run it on a headless system - such as a server easily.

    When verbs are used it is always slower - because the gui is triggered.

    For your case - I would avoid using FileSave / FileClose / FileQuit it is not necessary.

    There are a couple of ways it can be done:

    1. Allowing Inkscape to just save a new copy of the original file using export-do ( Inkscape will add _out.svg to the filename - but only once )

    2. Using the export-do action with export-filename

    Verbs require the option --batch-process
    or the option --with-gui to be used. 
    I think --batch-process is better for most cases.

    So for your problem:

    inkscape --batch-process --actions="FitCanvasToDrawing;export-do" *

    Would create a new set of svg files - all prefixed _out.svg

    or 

    inkscape --batch-process --actions="FitCanvasToDrawing;export-filename:my_filename.svg;export-do;" drawing.svg

    Would save the altered file to my_filename.svg

    If you want you can use export more than once in the same line:

    inkscape --batch-process --actions="FitCanvasToDrawing;export-filename:my_filename.svg;export-do;export-filename:my_filename.png;export-dpi:300;export-do;" drawing.svg

    The above line would save an .svg and a .png ( png at 300 dpi )

    Using export-do etc is better if you want to control filenames using a script - timestamp them etc.

    I wrote a simple webpage to help me build command lines, you might find it helpful:

    https://www.raincloud.co.uk/svg/ibc/ibc.html

  5. #5
    inklinea inklinea @inklinea⛰️

    I should add - the official page for the command line is https://inkscape.org/en-gb/doc/inkscape-man-1.1.x.html

    It can also be accessed from Inkscape Help>Command Line Options

  6. #6
    Sayad Pervez Sayad Pervez @sayadpervez
    *

    Thank You very much for your support

Inkscape Inkscape.org Inkscape Forum Beginners' Questions How to see what INKSCAPE command is getting executed when am performing an action in the GUI