Acly / krita-ai-diffusion

Streamlined interface for generating images with AI in Krita. Inpaint and outpaint with optional text prompt, no tweaking required.
https://www.interstice.cloud
GNU General Public License v3.0
6.81k stars 333 forks source link

Stored History - Compression Settings #834

Open Phyto440 opened 4 months ago

Phyto440 commented 4 months ago

Hello, I've been using Krita AI Diffusion for the past few days, and I think it's an absolute game changer for ease of refining AI generated images. However, I've since noticed that there is significant compression quality loss in the Stored History images. If I understand the way it works correctly, any generated images not applied to the canvas during the current session, are compressed down when saving the .kra file (as individual webp files).

I first noticed this after reopening a project and seeing that fine details like that of skin texture or stubble were significantly softened/blurred due to the level of compression when compared with their applied versions. There were also significant artifacts on previously smooth gradient areas. I've attached a couple images showing the amount of image degradation. I don't agree that the current compression setting is high quality. #627 Would it be possible to allow users to decide what level of quality these history images are saved at?

flesh ball 4x lossless flesh ball 4x lossy

Normally, while working on images in Krita or GIMP, I'm accustomed to working iteratively and non-destructively, on many unmerged layers. I don't recall running into any storage or file size issues due to this, but perhaps Krita does have a limit to file size? I have noticed it's not possible to set the Stored History setting beyond 100 MB, and I'm not sure what happens once that is reached though I'd set it as high as possible to keep all generations. I assume that implementing lossless compression would make a file reach this 100 MB maximum fairly quickly.

Perhaps, if some compression must be maintained to avoid the .kra files becoming too unwieldy, then some other setting could be enabled to simply write all generated images to a specified directory outside of Krita (as if an extra Save Image node were added to each ComfyUI workflow). I'd greatly prefer the option to keep lossless copies of all of these image generations as storage is so cheap these days.

Possible workarounds:

Sorry if this seems like a huge nitpick, but I thought I'd offer some feedback as a user.

Acly commented 4 months ago

Storing lossless copies beyond 100MB is possible, I don't think there's a hard limit. There are practical concerns:

Regarding dumping all generations and non-destructive workflows: The way I see it, you also don't save a snapshot of every brush stroke you make, every selection copy, every transformation, each resize, etc. It's completely impractical. You use layers or masks explicitly for certain checkpoints you care about. I just don't see how AI generation is any different. Often it's only a tiny piece in a workflow.

This doesn't mean a lossless option can't be useful, maybe shorter history is a good trade off for keeping original quality.