Skip to content
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

[BUG] Cropping is ignored in img2img #441

Closed
Lugribossk opened this issue Sep 1, 2022 · 1 comment
Closed

[BUG] Cropping is ignored in img2img #441

Lugribossk opened this issue Sep 1, 2022 · 1 comment

Comments

@Lugribossk
Copy link

Describe the bug
In init() the line image = init_img.convert("RGB") is repeated after resizing, leading to the original size being used: https://github.com/hlky/stable-diffusion-webui/blob/45fafec68a14187bc65f8e2b7015e3f4ace3c358/webui.py#L1193
This then gives an error when the input image is not 512x512.

Commenting out that line gives the expected behavior.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the img2img tab.
  2. Keep the example image and enter any prompt.
  3. The script encounters an error:
  File "C:/Code/stable-diffusion/scripts/webui.py", line 1343, in img2img
    output_images, seed, info, stats = process_images(
  File "C:/Code/stable-diffusion/scripts/webui.py", line 859, in process_images
    samples_ddim = func_sample(init_data=init_data, x=x, conditioning=c, unconditional_conditioning=uc, sampler_name=sampler_name)
  File "C:/Code/stable-diffusion/scripts/webui.py", line 1249, in sample
    xi = x0 + noise
RuntimeError: The size of tensor a (128) must match the size of tensor b (64) at non-singleton dimension 3

Expected behavior
The image should be cropped.

@Angelore
Copy link

Angelore commented Sep 1, 2022

You can change this locally for now, just change init_img to image in the line you mentioned.
It was mentioned here, but not implemented for some reason: #398 (comment)

hlky added a commit that referenced this issue Sep 1, 2022
@hlky hlky closed this as completed Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants