chrisgoringe / cg-image-picker

198 stars 13 forks source link

The HTMLImageElement provided is in the 'broken' state #89

Closed scxsyu closed 1 month ago

scxsyu commented 4 months ago

When running to the preview chooser node, the image is not displayed. As soon as the mouse moves, the browser window freezes, and nothing is displayed on the node. The console throws an error: "Uncaught DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The HTMLImageElement provided is in the 'broken' state." The error occurs at this line of code: "ctx.drawImage(img, imgX+cell_padding, imgY+cell_padding, imgWidth-cell_padding2, imgHeight-cell_padding2);" I am using the Edge browser.

chrisgoringe commented 4 months ago

I can't reproduce this - any other information that might help?

scxsyu commented 4 months ago

image image I have tried switching to Chrome, disabling all browser extensions, disabling all custom_nodes of ComfyUI except manager and picker, but the error still occurs. Now I run the picker in a minimized window and can use it with hotkeys.

chrisgoringe commented 3 months ago

I still can't reproduce this. Could you share a workflow - as simple as possible - that has the problem?

Also, are you running the latest Comfy?

rsl8 commented 1 month ago

https://github.com/chrisgoringe/cg-image-picker/blob/6242c01fa64136991512b0596600ea9b8050828e/js/image_chooser_messaging.js#L13 https://github.com/chrisgoringe/cg-image-picker/blob/6242c01fa64136991512b0596600ea9b8050828e/js/image_chooser_preview.js#L20

There are some urls with absolute paths in the js code. It can't work with comfyui accessed with a path prefix.

If I remember well, there was yet another 404 error in my console - /scripts/widgets.js? I'm not sure now.

chrisgoringe commented 1 month ago

@rsl8 opened this as a new issue, since I don't think it's related!

rsl8 commented 1 month ago

Thanks Sorry for not collecting and providing all info immadiately. The problem I faced was exactly the same as the issue described by @scxsyu (the same exception and ui freeze) Removal of the slash at the beginning of the following path was enough to fix it: https://github.com/chrisgoringe/cg-image-picker/blob/6242c01fa64136991512b0596600ea9b8050828e/js/image_chooser_preview.js#L20

(and the /scripts/widgets.js error was caused by an other extension.)

rsl8 commented 1 month ago

Could the issue be reopened?

108 has been separated, but there is also a second part worth improvements as http errors don't seem to be handled sufficiently.

chrisgoringe commented 1 month ago

Added #110 to keep the issues cleanly separated