Currently, kra provides options to compress files the *.kra archives some more. It’s a very useful feature for archival but not so useful for general use because it makes krita much slower to save and load files while working on them.
Create API or GUI which allows mass-compression of krita files.
Possible easiest fulfillment:
One very valid way is through command line options.
For example, command line options to make use of the compression options that krita has for archival purposes at reasonably much smaller sizes than no compression.
With the suggestion of command line options into account, the API could be done as:
--kra <path> → Operation on kra file --compress-more → Activate Compress .kra files more until program closes --compress-zip64 → Activate Use Zlib64 until program closes --compress-trim → Activate Trim files before saving until program closes
With these options, I think it’s enough to fulfill such objective.
Any opinions/suggestions for improvement of this suggestion?
This is absolutely correct, but to be “artist-ready”, this should be done via a GUI based solution.
As we can currently see in this topic, “Is there something we can help with my knowledge? Proposal for the forum”, it seems very important to enable usability for all, and the command line discourages a large part of the users.
And a feature that can be helpful to all users should be usable by all without hurdles.
Otherwise, I can already see the questions from users here in the forum: “Which exact command line do I use to achieve which compression?”
I’m fine with that but I’m a complete disaster with UI. We’d need someone extra to define it and then someone else to implement it.
Wouldn’t that take a long time?
If so, then it could be as an improvement in the future…
I’m not a programmer, but if you know a bit about it, then in conjunction with @KnowZero’s “Python Plugin Developer Tools” you should be able to easily create such a plugin. GUI included.
It is presented here:
You can download it here:
Edit/Add: And you can always ask here in the forum. There is also a Matrix-Chat and you can reach the developers via IRC if necessary.
As I said, I’m not a programmer, but could it be possible, for example, to select the compression rates via a drop-down menu? Of course somehow this info has to be passed to the compressor as well, but I have something like a predefined rule set in mind, not a command line to be handed over.
Hi, I have here a recompresskra.sh script; it is a bit complex, take a lot of time to run, but I batch it over large directory sometime at night. The main logic and commands are:
Copy the Krita file target to a temporary directory in tmp/
unzip the krita file (with unzip command line)
optipng the mergedimage, thumbnail
zip -9 -r back the full content
Move back and rename as the Krita files.
I get a very good compresion with that but very similar to what the checkbox in Krita option does. I made that because I could batch it over many files to reduce the weight of all the Krita files I have on my disk and can’t archive because they are ‘active’ (eg. all Pepper&Carrot pages, artworks, sketches; in sync with remote server).
I don’t know if i am understanding the point of the discussion. But if we are talking about batch operations for archival purposes wouldn’t using the krz ( the krita archival format, i never know how to write it) be useful for this case?
I believe you can run plugins through command line with the kritarunner though i have only heard about it in passing and the lack of documentation doesn’t help.
While commandline is very useful many are intimidated by using it so having a ui would be useful. One thing i would like to point out is that by making it a plugin that executes while running krita you might lock the user from doing anything else while the process is happening.
Which makes me think if a plugin that calls a external script to be run on a separate terminal could help. As you would have a parallel process running and krita would still be usable. The plugin would be just an interface to build the command line that calls the script.
But these are just ideas, i am not sure if they would work as i described them as i only know the basic of the krita plugin API but hopefully any of this can bring more ideas.
If there wasn’t a need to navigate all the way to that menu it would be (possibly) acceptable…
However, I could win best to have it compressed the most during night time when I do the backups and such. I do that about once per week.
Given so, an automated way would be preferible
Oh! Ok. I’ll add that to the documentation after some testing, then!
Additionally, do you know what zip compressions krita supports for opening? Is it only Deflate and Deflate64? Does it support lzma, for example? knowing that would speed up my process by a lot!
Additionally, if you can tell what the trim process actually does, maybe I can automate it somehow.
Krita uses minizip internally, Minizip: Zip and UnZip additionnal library, through quazip. Krita itself only uses Z_DEFLATED. Trim removes layer content outside the image bounds. It’s the equivalent of Image->Trim to Image Size.