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

Flux Redux cropping non square images. #1648

Closed
aivanis opened this issue Mar 8, 2025 · 6 comments
Closed

Flux Redux cropping non square images. #1648

aivanis opened this issue Mar 8, 2025 · 6 comments

Comments

@aivanis
Copy link

aivanis commented Mar 8, 2025

When working with non square images redux will crop the image.

I opened the workflow to see why is this happening and I can see that the comfyui-tooling-nodes do not have the option to work with rectangular images.

I tried to fix this myself and I changed the workflow to use these native nodes which have the option crop:none and it works as expected, however range functionality is lost this way...
Image

@aivanis aivanis changed the title Redux cropping no square images. Redux cropping non square images. Mar 8, 2025
@aivanis aivanis changed the title Redux cropping non square images. Flux Redux cropping non square images. Mar 8, 2025
@Acly
Copy link
Owner

Acly commented Mar 9, 2025

Clip vision always works on square (224x224) input images. crop=none means non-square image is stretched and its aspect ratio broken. I'm not sure how useful is it? At extremes it probably leads to bad proportions.

Note that you can always prepare the image to be square yourself with transform tools, doing a mix of crop/stretch that you find acceptable.

@aivanis
Copy link
Author

aivanis commented Mar 9, 2025

Hey thank you for the reply. Here is why it is useful from my perspective as a user. I read on BFL blog flux redux can be used to change the style of the image e.g. photo to anime. So I load my portrait 9:16 image to krita, set it as a reference and write a prompt to generate an anime image. To my surprise the result was headless me...
Even though the input is resized to 224x224 you can still generate the output of the original resolution. Very useful for changing style.

@Acly
Copy link
Owner

Acly commented Mar 9, 2025

yea you need to resize/crop it so it still has its head :)

the question is, does the crop=none actually solve the problem, or does it just give stretched/bad proportion instead?

@aivanis
Copy link
Author

aivanis commented Mar 10, 2025

It solves the problem. Even though the reference image becomes square and aspect ratio is broken, you should leave the latent input to be initial non square resolution and it will output the wanted result. The influence of the reference is stretched.

@Acly
Copy link
Owner

Acly commented Mar 11, 2025

I did some tests. Depending on the subject the resize does have a negative influence, like people in portrait format input become more chubby. But it's usually less bad than chopping their heads off, so I'm going to put it as default.
How bad it is depends on model and ip-adapter vs redux as well, Flux can deal with it okay it seems, although I'm not sure if that's because it doesn't like to generate chubby people in the first place.

For best results you still have to crop/resize manually. Probably you saw, but your reference image does not need to have the same size as your canvas/output. You can just have transparent areas in the layer, they will not be included, so generating a portrait image with square reference works.

Acly added a commit that referenced this issue Mar 11, 2025
- this would have to happen anyway (model input is fixed)
- previously was using a center crop, now it's a scale
- stretching/squashing image contents does negatively influence references, but usually not as bad as crop
@aivanis
Copy link
Author

aivanis commented Mar 11, 2025

Hey, yes I later realized I it doesn't have to be the same size as canvas. Thank you for the change, I agree it still looks better then crop, especially as most users probably don't know it needs to be square.

@aivanis aivanis closed this as completed Mar 11, 2025
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

2 participants