mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
19c5435332
There's a bug in chrome that screws with headers on fetch requests and 307 responses. This causes images to fail to copy in the commercial environment. This change attempts to get around this by copying images in a different way (similar to how the canvas works). When the user requests a copy we: - create an `<img />` element - set `crossOrigin` if needed - add an onload handler: - create a canvas element - draw image onto it - export canvas to blob This is wrapped in a promise which resolves to the blob, which can then be copied to clipboard. --- A customized version of Konva's `useImage` hook is also included, which returns the image blob in addition to the `<img />` element. Unfortunately, this hook is not suitable for use across the app, because it does all the image fetching up front, regardless of whether we actually want to copy the image. In other words, we'd have to fetch the whole image file even if the user is just skipping through image metadata, in order to have the blob to copy. The callback approach means we only fetch the image when the user clicks copy. The hook is thus currently unused. |
||
---|---|---|
.. | ||
CLI | ||
install | ||
merge | ||
training | ||
web | ||
__init__.py | ||
legacy_launch_invokeai.py |