stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[BUG] Img2img upload dialog on linux not showing PNG

Open dogarrowtype opened this issue 2 years ago • 11 comments

Describe the bug Longstanding bug: On an arch linux host, png images are not selectable to upload to img2img unless image type is changed from "all supported types" to "all files". Only jpg and gif show up without changing the setting. This setting has to be changed every time an image is uploaded, within the file upload dialog.

To Reproduce Steps to reproduce the behavior:

  1. Open file chooser in img2img
  2. See pngs are missing

Expected behavior Png files should be selectable to upload.

Desktop (please complete the following information):

  • OS: Arch linux, Fedora 36 Any browser.

Additional context This may be an issue with dependencies on my local install, but I can't figure out what is causing it. This may be a local bug. This bug has been present since the earliest versions. It has never worked, so if this isn't expected behavior, it is likely a local bug, and you can close the issue. But it may be worth finding the cause to ensure it doesn't happen to other users.

dogarrowtype avatar Aug 29 '22 00:08 dogarrowtype

Sounds like a Linux issue imo

hlky avatar Aug 29 '22 01:08 hlky

So this behavior doesn't happen on other platforms?

dogarrowtype avatar Aug 29 '22 01:08 dogarrowtype

@dogarrowtype I'm seeing this on Windows 10 21H2

image

so it does seem like a linux issue

hlky avatar Aug 29 '22 02:08 hlky

Screenshot from 2022-08-28 22-05-04 Alright. These are the only options I get across multiple computers. I suspect this might be an issue with my version of pillow, but that's just a guess.

dogarrowtype avatar Aug 29 '22 02:08 dogarrowtype

Not sure what's setting the filetypes on the input box tbh. I'll look into it but might not be fixable.

hlky avatar Aug 29 '22 02:08 hlky

Hmm, on my Pop!_OS 22.04 setup, I don't have this issue. I can see both jpg and png files just fine. Seems like it may be an issues with your file manager implementation @dogarrowtype? Or whatever that window is that's being used for file selection. The base file picker on Pop works as intended, though it's just "Custom Files" (which is gonna be just images) and "All Files." So mine doesn't actually break it down into categories like that, but I can still see and select PNG's and JPG's like normal.

JoshuaKimsey avatar Aug 29 '22 02:08 JoshuaKimsey

Extremely helpful @JoshuaKimsey . This bug was happening on Fedora 36 and Arch Linux, but it turns out it was firefox alone. On chromium 103.0.5060.114, I get the same behavior as above. But on firefox 104, I get the described bug behavior.

Still, strange. Can anyone else using firefox on linux confirm?

dogarrowtype avatar Aug 29 '22 02:08 dogarrowtype

Still, strange. Can anyone else using firefox on linux confirm?

Can confirm, I just booted up Firefox and it does not list PNG's in the file picker, which is a rather unique bug/oversight on Mozilla's part... But so yeah, not a bug associated with the Stable Diffusion fork, so you're good. :)

JoshuaKimsey avatar Aug 29 '22 02:08 JoshuaKimsey

Hmmm. I wonder what in the code is causing this. Obviously, you can select PNGs on other sites on firefox, so I wonder where this is coming from. Maybe gradio is using some funky html tag to specify it wants images, and firefox is choosing the wrong list of possible inputs?

dogarrowtype avatar Aug 29 '22 02:08 dogarrowtype

firefox is choosing the wrong list of possible inputs

This seems likely, if I had to guess. I did find this info online that might help out with this issue. On a file input selector, it can accept an attribute of accept that allows for specific types of files to be uploaded. like this: <input type="file" name="uploadedimage" accept="image/png, .jpeg, .jpg, image/gif">

I don't know if this would help @hlky out, or if this is even how Gradio works. But, that may be where the issue stems from. See the images below for more information.

Screenshot from 2022-08-29 00-21-15 Screenshot from 2022-08-29 00-20-31

JoshuaKimsey avatar Aug 29 '22 04:08 JoshuaKimsey

@JoshuaKimsey do you want to submit this as an issue to Gradio and see what they say?

I think the 'accept' attribute must already be set by Gradio otherwise it would just be saying all files for everyone.

Other than that we could use javascript to get the <input> element and .setAttribute('accept', "image/*") or whatever accept value fixes it.

hlky avatar Aug 30 '22 09:08 hlky

@hlky Yeah, I can go give them a poke and see if they know about it.

In the meantime, the JS solution is definitely a viable option. Done that before when dynamically generating tags in the past, so it should work here too.

JoshuaKimsey avatar Aug 31 '22 00:08 JoshuaKimsey

Sure, or @altryne can mention it when he speaks to them next.

hlky avatar Aug 31 '22 01:08 hlky

Sure! That works, if he's more familiar with how things work there, then he can do so.

If you need any help with the JS in the meantime, let me know. I definitely know how to work with that, albeit not via Gradio but it shouldn't be too hard to implement even with that. :)

JoshuaKimsey avatar Aug 31 '22 01:08 JoshuaKimsey