How can I export a krita (kra) document with many layers to a png using command line?

  • I have no experience with krita, and don't know what a kra document is, but if you intend to convert to a png format and have many layers, you'll have to flatten the image first as png doesn't support layers. This is how I would handle a multi-layer image in Gimp. I don't believe you can do this from the command line with the document in its current state. – Elder Geek Apr 22 '15 at 13:49

There is Calligra Converter:

sudo apt-get install calligra-libs

run with

calligraconverter input_file output_file

or you could try this solution:

Artscript in Files/Nautilus

Artscript is a software to convert/watermark/glue-together on the fly a big range of images format. Even SVG, *.kra and *.ora.

Download and unzip Artscriptk source code in a folder. Get the last here

  • Then with Files go to /home/<yourusername>/.local/share/nautilus/scripts
  • Create a file Artscriptk
  • touch Artscriptk
  • give it execution permissions

    sudo chmod +x Artscriptk 
  • and edit it:

    gedit Artscriptk
  • paste this inside, and customise the path depending where you unzipped Artscriptk sources:

    /home/<yourusernamehere>/path/to/artscriptk/artscript2.tcl $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS

Now you can select files in Files/Nautilus, and do right click→script→Artscript and send the files to Artscript for using it.

| improve this answer | |

I tried this on Linux subsystem for Windows (WSL), but for some reason it doesn't work. I figured out a quick little workaround though.

.kra files are really just archives, and they actually have 2 png versions of your image inside: mergedimage.png and preview.png. So you can just use 7z or another archiving tool to extract the mergedimage.png.

so in one command that would be:

7z x my_image.kra -o. *.png


7z x my_image.kra -o. mergedimage.png

if you only want the latter.

the -o. flag sets the output directory to the current directory, you might want to play around with that.

| improve this answer | |

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.