Direct fix for FLUX.1-dev always generating square images:
Most likely, FLUX.1-dev or its pipeline is hardcoded for square outputs. Some image generation models ignore height and width unless explicitly enabled or unless a specific model checkpoint supports arbitrary aspect ratios.
What to do:
Check the model documentation: Confirm whether custom dimensions are supported in your version. Many open-source diffusion models only allow 512x512 or 768x768 natively unless you use a specific "inpainting" or "XL" variant.
If the model only allows square images:
Crop or resize output after generation, or
Switch to a model that supports arbitrary image sizes.
Sample code for forced resize after generation:
from PIL import Image
After generating the image
out.save(“image.png”)
img = Image.open(“image.png”).resize((768, 1360))
img.save(“image_horizontal.png”)
If custom size is supported and still ignored:
Update diffusers, restart your environment, and ensure you are not passing additional unwanted arguments.
Try explicitly setting pipe.scheduler or use a pipeline that supports arbitrary aspect ratios.
Solution provided by Triskel Data Deterministic AI.