FLUX.1-dev in n8n

Hello

Why in n8n FLUX.1-dev creates only square images? And how to make horizontal ones. The dimensions don’t work in promt.

I’m using HTTP Request

prompt = “{{ $json.message.text }}”
out = pipe(
prompt=prompt,
guidance_scale=3.5,
height=1360,
width=768,
num_inference_steps=50,
).images[0]
out.save(“image.png”)

but it doesn’t work - the output is always a square image

1 Like

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.

1 Like