I made 18 decals for no signal but I
didn't want to export all of them manually. So, I
tried to figure out how to export krita images in
bulk. According to krita --help
, there
is an --export
and a
--export-filename
flag that I would
expect to work. I figure out how to use these
flags:
krita 1a.kra --export --export-filename 1a.png
However, Krita just exports an empty image.
According to the Krita documentation, the
--export
flag should work for
this:
This is primarily used in bash or shell scripts, for example, to mass convert KRA files into PNGs.
Through internet searches, I find out that you
can also export the PNG by treating the Krita file
as a zip. I found a Krita mass export repository
treating the Krita file as a zip archive, which says
that the file is named mergedimage.png
and that it is in the first directory level:
def export_kra(src: T.Union[str, Path], dst: T.Union[str, Path]): with ZipFile(src) as src_zip: 'mergedimage.png', '/tmp/') src_zip.extract('/tmp/mergedimage.png').rename(dst) Path(
I don't want to figure out how to run this repository, so I look for a way to extract a specific file from a zip instead:
unzip -p myarchive.zip path/to/zipped/file.txt >file.txt
This gives me the following command, which works!
unzip -p 1a.kra mergedimage.png >1a.png