-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for "Send To img2img" Type Buttons #6541
Conversation
also remotely related issue #6434 - using urlencoded image for "send to ..." is not the greatest option to start with as all PIL Image properties are lost during transfer. this fix is still valid, just noting general issue. |
Adding The one thing I'd accept from this PR is the first line, because as I see it would prevent red ERROR messages if you do "send to" without an image. vladmandic: i think metadata in those base64 dumps could work, if it's actually included in the file. |
Hi, @vladmandic may I ask, this base64 thing (sorry, im not good at coding or programming) could be related to this issue? #6388 (comment) Related to the "send to" button and the --gradio-img2img-tool color-sketch argument? |
possible, but honestly no idea - i'm not a gradio expert by any means. |
I'm probably missing something... but if the problem is, that gradio now returns a link in the form of
|
i think thats on the right path... |
I would tentatively agree, but I have zero knowledge of gradio or io.BytesIO. If base64 encoding is not present in newer versions of gradio links, keeping the base64 decoding would be in the best interest of backwards compatibility. I will try to play around with this change later today, but see no immediate reason why this solution wouldn’t work. Would be happy to update my pull request if AUTOMATIC1111 agrees with vladmandic on AIUIkesh’s suggestion. |
Like I wrote before, I'd only accept the first line (and replace Using The bat file is also definitely not making it in, if the user wants, he can upgrade pip however he likes. |
I looked a bit into this from the extensions's side. Automatic is right of course. The extension needs to send a gallery object, instead of a filename. What's more, there already is a fix for this, just nobody has merged the commit on the extension's side. |
In the extension repo pull request yfszzx/stable-diffusion-webui-images-browser#51 does not fix all errors related to this behavior, as mentioned by many users in issue yfszzx/stable-diffusion-webui-images-browser#69. But @Googolplexed06's suggestion works for all users. |
I installed image browser and it sends image filename to the function you're editing. It was never meant to work to like this, never did, and it won't. The image can be either a gradio image object represented by a dict, a data: uri or a base64 encoded image data. I'm closing this PR. |
Small tweak to prevent an error where sending an image to another tab via a "Send To" type button expects base64 encoded text and attempts to decode it, but fails because image may not be base64 encoded. This occurs because
image_from_url_text()
attempts a decode whether or not thefiledata
has the "data:image/png;base64," string in front, which I expect to be an identifier that the decoding is necessary. My fix performs the decoding if the base64 identifier is present, or skips it if unnecessary. While I was digging around, I also realized that clicking any "Send To" type button while no image was present in the above viewer would cause an error, since theif filedata.startswith("data:image/png;base64,")
check would be performed on aNone
type which obviously has no.startswith()
, so I added a small checkif filedata == None: return None
to circumvent this error. This change was made in light of the error being caused by the extension Image Browser as described in issue #69, which is where I first offered my fix.Although "Send To" type buttons work outside of the Image Browser extension without this change, they are not negatively impacted by this change. I have done moderate testing (i.e. pushing all "Send To" type buttons in most/all tabs) on my client and have experienced no new errors or bugs as a result of these changes. I am unfamiliar with how the Web GUI encodes and sends its
filedata
between tabs, so please advise or correct me if some of my changes were made in error.I also created a small .bat file to manually update the python venv pip module since there was a recent pip update, and decided to suggest adding it to the repo as well.
Deployed on:
OS: Windows 10 Pro
Browser: Brave (chromium based)
Graphics Card: NVIDIA RTX 2070 8 GB