zero01101 / openOutpaint

local offline javascript and html canvas outpainting gizmo for stable diffusion webUI API 🐠
MIT License
503 stars 44 forks source link

[Bug]: All resources lost on refresh after "Upscale Resource" #293

Closed Metachs closed 1 week ago

Metachs commented 3 weeks ago

What happened?

After Upscaling an image using the Upscale Resource button in the resource list, all resources are lost if the page is refreshed without making other changes to resources.

This can sometimes be avoided by changing the name of the newly added upscaled resource, or adding additional resources before refreshing or closing the tab.

Steps to reproduce the problem

On a new page, switch to the stamp tool and use Upload Image to add an image to Resources. Click the Upscale Resource button in the resource list, and wait for the upscaled image to appear. Refresh the page, and switch back to the stamp tool, resources list is empty.

What should have happened?

Resources should persist as usual after Upscaling.

Commit where the problem happens

latest

What platforms do you use to access openOutpaint?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Browser Extensions/Addons

None

AUTOMATIC1111 webUI Commandline Arguments

--port 7866 --api --cors-allow-origins-regex .*

Additional information

No response

Metachs commented 3 weeks ago

In case it helps, I believe this was caused by the image not being fully loaded, and you need to await img.decode(); at some point after assigning img.src here https://github.com/zero01101/openOutpaint/blob/e7c08846d2b1e324f32fde9803d1c830d331ef3a/js/index.js#L1556

This fixed it for me anyway.

zero01101 commented 2 weeks ago

@Metachs much obliged for the report; will check into this, but please feel free to submit a PR since you're the one who fixed it already ;)

zero01101 commented 1 week ago

should be fixed up thanks to @Metachs :)