InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: Image looses detail when merging canvas or saving image

Open ThatmewH opened this issue 3 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS

Windows

GPU

cuda

VRAM

16GB

What happened?

When merging the image or saving the image in the unified canvas, the image looses some detail, and when you do it multiple times the image will be significantly worse than the original.

Screenshots

image image

The first image was the original, and the second image has lost a significant amount of detail after merging canvas multiple times. Saving the image repeatedly also affects the image quality.

Additional context

No response

Contact Details

No response

ThatmewH avatar Dec 31 '22 01:12 ThatmewH

I'll fix this up in a future patch.

blessedcoolant avatar Dec 31 '22 07:12 blessedcoolant

yes, the same is happening for me!

Dalasito avatar Jan 04 '23 20:01 Dalasito

I fixed this in the next release.

blessedcoolant avatar Jan 04 '23 20:01 blessedcoolant

Awesome, thank you for your amazing job @blessedcoolant ! I noticed also the saturation goes up very fast, maybe the compression? I don't know, fyi! Any expected release date?

Dalasito avatar Jan 05 '23 12:01 Dalasito

Awesome, thank you for your amazing job @blessedcoolant ! I noticed also the saturation goes up very fast, maybe the compression? I don't know, fyi! Any expected release date?

The issue was happening because of a rounding down error which was displacing the pixels every so slightly. So the subsequent merges just kept getting displaced a tad bit giving it the vibe of quality deterioration. I did not notice any saturation issues after the fix. But I did not check if there were any before the fix either.

We are working on a major backend port to diffusers. But I think we might do a small mini update before that. I'll ship this fix in that mini update.

blessedcoolant avatar Jan 05 '23 12:01 blessedcoolant

Yes, I just checked it and you can see, after around 10 saves (save the unified canvas image, then import the saved one, save again, repeat), the color saturation rockets. Maybe it's because that displacement that duplicated the image above? I'm not sure because I didn't see the code, but I'm certain the saturation does come up so high that you start to lose color detail too.

That is awesome! Again thanks for your amazing work!

Dalasito avatar Jan 05 '23 14:01 Dalasito

Yes, I just checked it and you can see, after around 10 saves (save the unified canvas image, then import the saved one, save again, repeat), the color saturation rockets. Maybe it's because that displacement that duplicated the image above? I'm not sure because I didn't see the code, but I'm certain the saturation does come up so high that you start to lose color detail too.

That is awesome! Again thanks for your amazing work!

There's a PR open with that fix. If you know your way around that, feel free to try it. It's not built yet though. You'll need to run in dev mode.

blessedcoolant avatar Jan 05 '23 15:01 blessedcoolant

Hey @blessedcoolant I'm unsure on how to run the dev mode, any link with documentation so I can try running your new code? Best!

Dalasito avatar Jan 07 '23 12:01 Dalasito

Hey @blessedcoolant I'm unsure on how to run the dev mode, any link with documentation so I can try running your new code? Best!

Are you familiar with working with Github Pull Requests and etc?

Basically you need to pull my PR. https://github.com/invoke-ai/InvokeAI/pull/2209

Then ..

  1. Install NodeJS
  2. Open a terminal in the frontend folder of the repo
  3. Install yarn npm install --global yarn
  4. Do: yarn install
  5. Do: yarn dev

This will run the development version of the frontend on port 5173.

You launch the main server first and then go to that port.

Alternatively you can do yarn build instead of yarn dev so the new changes can get compiled. Then you can launch the server and go to port 9090 and it'll work as usual.

blessedcoolant avatar Jan 07 '23 14:01 blessedcoolant