AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: DecompressionBombError using X/Y/Z #8504

Closed Imilkowski closed 1 year ago

Imilkowski commented 1 year ago

Is there an existing issue for this?

What happened?

After generating images with X/Y/Z plot there's an error connected with creating grid images:

DecompressionBombError: Image size (262144 pixels) exceeds limit of 440.00000000000006 pixels, could be decompression bomb DOS attack.

Steps to reproduce the problem

  1. Go to txt2img
  2. Select X/Y/Z plot
  3. Set X to Checkpoint name and add a few checkpoint names or anything else like Clip skip etc.
  4. Press generate

What should have happened?

Normally there should be no error, and a grid image should be written to files & be shown in the web window

Commit where the problem happens

5cea278

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--medvram

List of extensions

No

Console logs

Traceback (most recent call last):
  File "D:\stable-diffusion\stable-diffusion-webui\modules\call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "D:\stable-diffusion\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "D:\stable-diffusion\stable-diffusion-webui\modules\txt2img.py", line 53, in txt2img
    processed = modules.scripts.scripts_txt2img.run(p, *args)
  File "D:\stable-diffusion\stable-diffusion-webui\modules\scripts.py", line 399, in run
    processed = script.run(p, *script_args)
  File "D:\stable-diffusion\stable-diffusion-webui\scripts\xyz_grid.py", line 616, in run
    processed = draw_xyz_grid(
  File "D:\stable-diffusion\stable-diffusion-webui\scripts\xyz_grid.py", line 309, in draw_xyz_grid
    grid = images.draw_grid_annotations(grid, processed_result.images[start_index].size[0], processed_result.images[start_index].size[1], hor_texts, ver_texts, margin_size)
  File "D:\stable-diffusion\stable-diffusion-webui\modules\images.py", line 206, in draw_grid_annotations
    cell = im.crop((width * col, height * row, width * (col+1), height * (row+1)))
  File "D:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 1234, in crop
    return self._new(self._crop(self.im, box))
  File "D:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 1252, in _crop
    _decompression_bomb_check(absolute_values)
  File "D:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 3164, in _decompression_bomb_check
    raise DecompressionBombError(msg)
PIL.Image.DecompressionBombError: Image size (262144 pixels) exceeds limit of 440.00000000000006 pixels, could be decompression bomb DOS attack.

Additional information

No response

waynoedm commented 1 year ago

Go to Settings / Save Images and Grids / Width/height limit for the above option, in pixels

Change it to the size that you would like.

waynoedm commented 1 year ago

After applying the settings, you likely have to restart SD / Automatic1111 for it to work.

ewebgh33 commented 1 year ago

I'm getting this error but not for saving the grid. Instead, reading it back in to retrieve the metadata. It won't retrieve because image exceed size. Not sure why it SAVED the grid in the first place, if that's the case. But I need this metadata back, and I can't load the image grid into PNG-Info tab because this error comes up: "exceeds limit of 178956970 pixels", bomb attack etc. Is there a way to bypass this or change a line of code somewhere in my local install?