thomasasfk / sd-webui-aspect-ratio-helper

Simple extension to easily maintain aspect ratio while changing dimensions. Install via the extensions tab on the AUTOMATIC1111 webui.
https://github.com/thomasasfk/sd-webui-aspect-ratio-helper.git
406 stars 66 forks source link

[BUG] Getting "image do not match" In Img2img Inpainting when using width or height that isn't a multiple of 64 #36

Closed DarkVamprism closed 1 year ago

DarkVamprism commented 1 year ago

Using this extension(which I love by the way) causes an error if I have a height and width not a multiple of 64, which usually happens if I lock the aspect to the image width+height.

Traceback (most recent call last):
  File "X:\Program Files\Stable Diffusion\stable-diffusion-webui\modules\call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "X:\Program Files\Stable Diffusion\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "X:\Program Files\Stable Diffusion\stable-diffusion-webui\modules\img2img.py", line 171, in img2img
    processed = process_images(p)
  File "X:\Program Files\Stable Diffusion\stable-diffusion-webui\modules\processing.py", line 486, in process_images
    res = process_images_inner(p)
  File "X:\Program Files\Stable Diffusion\stable-diffusion-webui\modules\processing.py", line 694, in process_images_inner
    image_mask_composite = Image.composite(image.convert('RGBA').convert('RGBa'), Image.new('RGBa', image.size), p.mask_for_overlay.convert('L')).convert('RGBA')
  File "X:\Program Files\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 3341, in composite
    image.paste(image1, None, mask)
  File "X:\Program Files\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 1731, in paste
    self.im.paste(im, box, mask.im)
ValueError: images do not match
thomasasfk commented 1 year ago

Huh I didn't think about this. I'll take a look when I have some time this weekend... Thanks for raising, sorry for the inconvenience.

DarkVamprism commented 1 year ago

No problem, your extension helps a lot when I can avoid this issue :) Thank you for your hard work!

On Wed, 29 Mar 2023 at 01:41, thomas @.***> wrote:

Huh I didn't think about this. I'll take a look when I have some time this weekend... Thanks for raising, sorry for the inconvenience.

— Reply to this email directly, view it on GitHub https://github.com/thomasasfk/sd-webui-aspect-ratio-helper/issues/36#issuecomment-1487346974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWFYRC2ZY2UUE7U66XZYGTW6MPEJANCNFSM6AAAAAAWK3OFY4 . You are receiving this because you authored the thread.Message ID: @.***>

SeA-luby commented 1 year ago

In fact: it only needs to be a multiple of 8

thomasasfk commented 1 year ago

Thanks all for raising this, I've pushed a quick fix to make the step back to 8 always. I think tomorrow I may make it configurable because there is still a valid use-case for non img2img not being a multiple of 8.

https://github.com/thomasasfk/sd-webui-aspect-ratio-helper/pull/37