I used to have a list of commands in a text file like this:

-f ./input1.svg -e ../output1.png -y 0 -w 72
-f ./input2.svg -e ../output2.png -y 0 -w 240

and used to run inkscape --shell < commands.txt.

But I cant figure out how to do that in Inkscape 1.0!

  • 4
    Inkscape 1.0 isn't released yet, you are probably referring to 1.0 beta1 or the current development version. Find instructions for the new command line here: wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line - and let us know if you figure out how to use it... Here's a possibly related bug report: gitlab.com/inkscape/inkscape/issues/428 – Moini Nov 4 '19 at 12:53
  • 1
    (maybe join the developer chat and try to get hold of one of Tav, ede123 or Mc - they are most likely to know how/if it works) – Moini Nov 4 '19 at 12:54
  • 1
    yea dev chat might be an option. the gitlab issue is actually from me:D – Nicolas Degen Nov 4 '19 at 13:59

After the release of Inkscape 1.0, one can now do it this way:

echo "file-open:$INPUT_FILEPATH/$INPUT_FILENAME; export-filename:$DESTINATION; export-width:$NEW_RES; export-do" >> commands.txt

# Repeat above for each file

echo "quit" >> commands.txt

inkscape --shell < commands.txt
rm -f ./commands.txt

  • Is anyone able to make this work correctly on the Windows command line instead of Linux? – feedMe Mar 25 at 12:04

To just make it work again (not using the --shell mode), you could handle reading your commands.txt outside of inkscape and pass single commands to it. If you use xargs, you could run it even in parallel.

Assumming you have a commands.txt with all arguments in one line per input file, like

--export-filename=test72.png --export-width=72 input.svg
--export-filename=test36.png --export-width=36 input.svg

you could execute them as a batch like this:

cat commands.txt | xargs -P2 -L1 inkscape

-P<number> optional: is the amount of threads you want to run in parallel (using not more than you have cpu cores in your device available is reasonable)

-L1 specifies how many non-empty lines of your input file are passed as arguments to inkscape

  • This is fine, but it calls inkscape once for each line, as opposed to calling the inkscape executable with a list of files to convert. If you want to convert many files your approach will be significantly slower. Passing a batch file with a series of commands to inkscape in --shell mode seems to work well in Linux but I have had issues in Windows. Hopefully those issues will be resolved soon. – feedMe Mar 25 at 12:07
  • 1
    Yes, totally agree, its slow and reinitializes inkscape all the time and for that reason eats up the parallelization effect to a fair amount. I meant it more in a way to ad-hoc fix it (and throw as many hardware on it as available) and get away with that hopefully before improving further. If I remember right, Inkscape had quite some shifts in their API with releasing 1.0 there and it seemed that some features are still to come a little later and then allowing a nicer solution. – seb.friedrich Mar 25 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.