2

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

Zanna
  • 72,312

2 Answers2

3

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:

    #!/bin/sh
    /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.

A.B.
  • 92,125
1

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

or

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.