A way to avoid storing the visible result in a saved project

I noticed that when I save a kra document, it stores the visible result in full-res. For example if I have a large image inserted as a linked file layer, if I hide it, the resulting kra will be only a few kilobytes large but if I don’t hide it, it will be hundreds of megabytes large.

I need to keep my files light and I never want to store that visible part, so at the moment I just always group all the layers in a group that I hide right before saving but sometimes I forget to do it. If there was an option to disable the storage of the visible result in the general settings, I wouldn’t have to worry about that anymore.

Is there such an option?
If not, I’ll move this topic to the #develop:feature-requests category.

Hi

No, I don’t think there’s a such option.
I have the same problem, but on my side I prefer to keep preview of visible part :slight_smile:

One solution, rather than removing preview from kra file would be to save embedded preview as jpeg instead of png (reduced size and faster to save)
But this have to be discussed with developers because this is an heavy change in file format and can result with incompatibility for third party software (or for users that would like to send a kra file to another user for which Krita version is not able to read file…)

Grum999

That would also break many batch scripts which rely on the PNG preview. Many people including me and I think @Deevad, use this preview PNG to process images and export artworks in batch. The kra file is just a zip, so we unzip it and extract this PNG and then export it to other formats using imagemgick

Yes I know, I already work like this by myself too :slight_smile:
After changing scripts/plugins to read preview.png or preview.jpeg is not a big work for people who have implemented their own solutions.

It’s more for third party softwares that are currently able to read kra file through preview file that problem will occur: it can take time before change are taken in account (if they’re taken in account)

But for my own usage, a preview as jpeg file rather than png file would be a nice option, to gain place on disk AND to speedup file saving

And for @ChameleonScales case, option to not have preview file will decrease file size and speedup radically time need to save a file.

After, I can live without it too :smiley:

Grum999

Hey,

It’s not only my scripts; but also now Scribus, viewer like Nomacs, Gwenview and more software who are interested how to open/edit at least a flat projection of a Krita files.

Making it JPG would be destructive and while supporting the previewing aspect, it would break all editing/inserting for Scribus or video editing tools. So, better to keep it PNG lossless.

What I could see; a feature request for being able to save a project with crunching those extra features; with another file extension like *.krz maybe, compressing to max the zip container and not getting mergedimage.png. It could be interesting for long time archiving a project and backup.

1 Like

In the File handling section of the setting there are options for compressing large files, I think it can have the option to make it “.krz” with jpeg or may be combining the jpeg option into existing compress large files option may work.

Hi

Yes I know.
That’s why I’m talking about an option, like we currently have option on PNG/JPEG file saving about compression level and/or internal storage properties.

And I know that for third party software it can take time before being able to take in account change.

With option to save preview as jpeg (or no preview) I was just thinking about personal useage.
(default option would be like today: png preview file)

But Idea of a .krz extension is good; with an alternate file extension, people won’t ask why their kra file are not properly recognized by third party software if they use option of an internal jpeg preview…

Grum999

1 Like

Actually, for performance and space reasons we don’t store the mergedimage in autosave kra files, so the code for that is already there. It’s not an option (either global, or on saving to kra) because I’ve always been afraid of handling support load.

I understand :sweat_smile:

Grum999

I do like the .krz idea, though, that should be very implementable.

2 Likes

I like it a lot too because then we could in theory have a simple bash command to convert all the kra projects into krz recursively from the terminal, which would be very handy for archiving.

1 Like

It’s here: https://invent.kde.org/graphics/krita/commit/3ff173292a751dd9b6bf82ecb722df386a7ee349 – will be part of Krita 5.

3 Likes

That is awesome. Thank you for working on it. Will it use the compress large files feature that we have in the file handling section?

Yes, it turns compression on.

1 Like

I remember on a topic (not able to find it) that previously you tried to find the best ratio compression/speed (and set compression level to 3 if I remember well - or maybe it was only for png merged preview? :thinking:)

Is the compression here is still 3? or is the compression level has been set to its maximum (9)?
I tried to take a look to commit but i did see where this compression level option is set :sweat_smile:

I think for a krz file, size is the priority, not saving speed and then compression level should be the maximum

Grum999

The PNG image is not saved. No preview image is added, so it doesn’t take space for it.

Yes I saw…

But if krz file format is dedicated to be an archive file, the most compression level you use, the smallest file size you get.
And that was just a question.

But doing some tests, maximum compression level applied on a kra file (without merged preview) is not so smallest than a file with a lower compression level.
Probably due to LZW compression already applied on layer’s tiles… :thinking:

So my question is not really relevant :sweat_smile:

Grum999

Yes, changing the zip level compression to anything other than Z_DEFAULT_COMPRESSION doesn’t do much good : the first file is default, the second file is “best” – same image, same data…

-rw-r–r-- 1 boud boud 189677 Feb 12 12:32 bla.kra
-rw-r–r-- 1 boud boud 189687 Feb 12 12:34 bla2.kra

Yes no issues. :smiley: I misunderstood.

:tada: :tada: :tada: Thank you!