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

Output images are converted to square images and aspect ratio is distorted #2504

Closed
1 task done
abidlabs opened this issue Oct 19, 2022 · 4 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@abidlabs
Copy link
Member

abidlabs commented Oct 19, 2022

Describe the bug

It seems that in some Spaces, the output images are forced to be squares and this distorts the width/height ratio of the image

E.g. https://twitter.com/osanseviero/status/1582823250832211968

image

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

Space: https://huggingface.co/spaces/runwayml/stable-diffusion-inpainting

Screenshot

No response

Logs

N/A

System Info

3.6

Severity

annoying

@abidlabs abidlabs added the bug Something isn't working label Oct 19, 2022
@freddyaboulton
Copy link
Collaborator

Wonder if it's cause of the style on the output Image: https://huggingface.co/spaces/runwayml/stable-diffusion-inpainting/blob/main/app.py#L75

@osanseviero
Copy link
Contributor

In this same space having some weird issue with the image being cut by half

Screenshot from 2022-10-19 23-33-43

@pngwn
Copy link
Member

pngwn commented Oct 24, 2022

The bug that @abidlabs is reporting here doesn't look like a bug at all. This isn't a styling issue, the actual image is distorted.

The author of this app has not constrained the image input to a square (https://huggingface.co/spaces/runwayml/stable-diffusion-inpainting/blob/main/app.py#L66) and then resizes to a square without cropping at all, which is expected to squash the image (https://huggingface.co/spaces/runwayml/stable-diffusion-inpainting/blob/main/app.py#L38-L39).

So I think this is expected behaviour. Now, if they did constrain the image to a square, the user wouldn't actually know about it until the image is generated and parts of the mask could be cropped out, so we should definitely improve the UX of the behaviour of the shape kwarg for Image. There is already an issue for this here (relevant comment linked):

The thing that @osanseviero mentioned is a different bug relating to the way canvas sizes are calculated based upon the source image, as far as I am aware.

@pngwn
Copy link
Member

pngwn commented Nov 8, 2022

I've confirmed this issue is an issue with user code. There are already issues for the other problems noted.

@pngwn pngwn closed this as completed Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants