Inkscape.org
Beyond the Basics Exporting multiple files (input files in files.txt)
  1. #1
    gaiking gaiking @gaiking

    Hi, I have 1,200 SVGs that I need to convert to PNG.

    Naturally, this is too many to list out individually / pass via the command-line, so I have created a text file "files.txt" which lists the full path of each file per line, however I am not sure how to load this in to Inkscape -- please can someone point me in the first direction...

    Command so far...

    "C:\Program Files\Inkscape\bin\inkscape.exe" --shell --export-type=png --export-width=512

     

  2. #2
    inklinea inklinea @inklinea⛰️
    *

    There are 3 ways you can use the command line.

    1. Allowing the GUI to open and close ( --batch-process ) option. This allows full access to all of the actions and verbs Inkscape provides. However if you use verbs such as those from the Edit menu etc there is a speed penalty.

    2. Using only actions, you can avoid the GUI and it is much faster, but you have fewer options, ie most verbs won't work.

    3. Shell mode, as with 2. anything that requires the GUI to operate will not work. Shell mode is quick because it does not open and close Inkscape.

    I don't know what your level of scripting knowledge is, if you know absolutely nothing then you can covert the entire set of svgs with a single command line and a wildcard * . However this operates in the same folder as the original svgs so is a bit risky if you don't have backups.

    inkscape --actions="export-width:500px;export-type:png;export-do;" *.svg

    The width setting is optional

    If you do want to write a windows 10 powershell script, I made an example to generate a commandLine.txt file list for all the svg files in the current folder 

    https://inkscape.org/forums/beyond/passing-a-batch-file-to-inkscape-in-shell-mode/#c26165

    The .txt file can then be piped into shell mode as shown below

    type commandLine1645646307.txt | inkscape --shell

    As with anything involving the command line and original files - don't - make sure you operate on backups.

     

     

     

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Exporting multiple files (input files in files.txt)