lpsandaruwan
lpsandaruwan

Reputation: 818

Export a png from kra, a krita document

I am developing a all in one image converter tool using bash commands. So I want to know how to export a krita, ".kra" document with many layers, to a "png" image using command line ?

Upvotes: 2

Views: 1592

Answers (2)

ghevan
ghevan

Reputation: 66

There is a command line converter for Krita. However from version 2.9 it was removed in favor of calling krita binary with arguments.

If krita version is 2.8 or less you should use calligraconverter

calligraconverter --batch -- input output

In 2.9 you would call krita like this

krita input --export --export-filename output

By default both commands output format is based on the output extension name. For more information run calligraconverter (2.8) OR krita(2.9) commands "--help".

Upvotes: 5

deimus
deimus

Reputation: 9875

Not a ready command-line utility solution as you wanted but still.

Found following python script from David Revoy's blog

Try to adapt it to your needs.

import sys, zipfile
import Image
import StringIO

if len(sys.argv) != 4:
    sys.exit('Usage: '+sys.argv[0]+' <Input> <Output> <Size>')

thumbnail = zipfile.ZipFile(sys.argv[1]).read('preview.png')

im = Image.open(StringIO.StringIO(thumbnail))
im.thumbnail( (int(sys.argv[3]), int(sys.argv[3])) )

im.save(sys.argv[2],'png')

Upvotes: 1

Related Questions