Mass export Krita files in the CLI

To mass export Krita files on the command line, you can treat the Krita file as a zip file and extract mergedimage.png. For example, in bash: 1

unzip -p image.kra mergedimage.png >image.png

To export all Krita documents in a directory, in bash: 2

for a in *.kra; do file=$(basename $a .kra); unzip -p $file.kra mergedimage.png >$file.png; optipng $file.png; done

According to the documentation, you can also invoke the Krita program with an export flag, but this didn’t work for me and I end up with a blank image instead: 1

krita image.kra --export --export-filename image.png

Footnotes

  1. 20241008204358 2

  2. 20250303201836