AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
140.82k stars 26.64k forks source link

[Feature Request]: Increase image input size limit in imgtoimg #15723

Open utopic-dev opened 5 months ago

utopic-dev commented 5 months ago

Is there an existing issue for this?

What would your feature do ?

There is a size limit for sending a file to imgtoimg I believe it is a maximum of 300mb, I also believe it comes from the Gradio interface, because even changing possible limits in grid files etc we still have this limit imposed, could anyone tell us where this limit to making a change is implicit, it would be incredible as it is limiting a number of cool things to happen, thank you very much in advance for your attention and congratulations on the incredible work 🙏

Proposed workflow

  1. Go to ....
  2. Press ....
  3. ...

Additional information

No response

w-e-w commented 5 months ago

sorry what and why 300 MB image?

it would be incredible as it is limiting a number of cool things to happen

such as?

utopic-dev commented 5 months ago

in an ultimate Upscaling process, using multidiffusion/tiled, we insert an input image, in image to image, we increase it in size, there is a limit to inserting an image of maximum 300mb, which makes it impossible to continue creating increasingly larger images, I believe That this input limit is from the Gradio interface, because any other limit I found, such as the grid limit to create a canvas, I have already been able to adjust, can you understand what I'm talking about?

missionfloyd commented 5 months ago

I'm not sure gradio has a limit by default. The option to limit the size of uploaded files was only recently added. Perhaps you're reaching the limit for data URLs.

Browsers are not required to support any particular maximum length of data. For example, the Opera 11 browser limited URLs to 65535 characters long which limits data URLs to 65529 characters (65529 characters being the length of the encoded data, not the source, if you use the plain data:, without specifying a MIME type). Firefox version 97 and newer supports data URLs of up to 32MB (before 97 the limit was close to 256MB). Chromium objects to URLs over 512MB, and Webkit (Safari) to URLs over 2048MB.

Have you tried loopback? image

utopic-dev commented 5 months ago

Understood, thank you very much for the clarification, I'm going to test the loopback, I believe you're right and I'm reaching the data URL limit, because even if I send the resulting image via being to img2img it hangs and can't send it and we also don't have any message in the terminal or warnings, I'll test the loopback and tell you here what I achieved, if I couldn't continue inserting increasingly larger files to continue with the upscaling I think the only alternative would be to create the same flow using the Automatic1111 SDK, do you have any suggestion? Thx

gorillabull commented 5 months ago

300mb image uploads will probably be a new feature in 3 months given how fast things are moving 😂

missionfloyd commented 5 months ago

we also don't have any message in the terminal or warnings

You might also check for JavaScript errors in the browser's Console (F12). image

create the same flow using the Automatic1111 SDK

If you want to try that, here's an img2img API example.

import requests
import base64

# Open input image
with open("input.png", "rb") as f:
    img = base64.b64encode(f.read()).decode("utf-8")

# Define parameters
payload = {
    "prompt": "hot air balloon",
    "init_images": [img],
}

# Send request
response = requests.post(url="http://127.0.0.1:7860/sdapi/v1/img2img", json=payload)
r = response.json()

# Save output
with open("output.png", "wb") as f:
    f.write(base64.b64decode(r["images"][0]))

See the API docs for parameters. image

Payloads can also be generated with this extension.