Generating AI images in n8n: DALL·E, gpt-image, Flux and Stability in practice
Published 30 July 2026 · 4 min read
Automatically illustrating every blog post, deriving product visuals for social media, generating a header image for each newsletter: image generation has gone from novelty to standard component of content pipelines in just a few years. The technological shift behind that industrialization is well identified: the work of Rombach et al. presented at CVPR 2022 ("High-Resolution Image Synthesis with Latent Diffusion Models", see on Google Scholar) — the founding paper of Stable Diffusion — brought the cost of generating a high-resolution image down to a few seconds of compute, paving the way for the cheap APIs we now wire into n8n. Here's how to build a complete pipeline: prompt, generation, editing, storage, publishing.
Three ways to generate an image in n8n
The OpenAI node (simplest). The native OpenAI node includes an Image resource with a generation operation: pick the model (DALL·E 3 or gpt-image), provide the prompt, set size and quality — the image comes back as binary data, directly usable by downstream nodes. The credential is the same as for your text workflows (setup details here).
HTTP Request for Flux, Stability and the rest. Models from Black Forest Labs (Flux) and Stability AI are called through a plain HTTP Request node: an authenticated POST with the prompt and parameters, then retrieval of the image — either as binary in the response or via a URL downloaded in a second node. Some APIs work asynchronously (submit, then poll for the result): the pattern is the same as for any slow API, with a Wait node between submission and pickup, plus the usual retries and timeouts.
Aggregation platforms (Replicate, fal.ai) expose dozens of models behind one API — the "one credential, many models" logic we cover for text with OpenRouter, applied to images.
The stage that changes everything: have an LLM write the prompt
The classic trap is injecting an article title or product name directly as the image prompt: results are flat and inconsistent from one item to the next. The robust pattern adds a stage: an LLM Chain turns the raw subject into a detailed image prompt following a fixed template — the brand's visual style, composition, palette, and what must not appear (text in the image, faces, logos). Lock the output with a Structured Output Parser (prompt, negative_prompt, ratio fields) and you get consistent visuals at scale, for an LLM cost that's negligible next to the generation itself.
Editing and deriving formats: the Edit Image node
A generated image is rarely publishable as-is. n8n's Edit Image node covers the essentials without any external service: resize, crop, overlay text or a logo, composite several images. The typical use case: generate one 1536×1024 image, then a Loop Over Items loop derives the article banner, the social square and the thumbnail — each format with the right crop and the logo in the right place. Images travel as binary data between nodes: if your workflows handle a lot of them, our guide to large files and binary data explains how to avoid exhausting the instance's memory.
Store, then publish
Store every generated visual before publishing — to reuse it, trace it, and avoid paying for generation twice. The usual targets: Google Drive for simplicity, an S3 bucket for production. Record the metadata along the way (prompt, model, date, source workflow) in a Data Table or a Google Sheet: that's your visual library.
At the end of the chain, publishing plugs into your existing pipelines: a header image in an automatically published WordPress post, a visual attached to an AI-generated LinkedIn post, or a message to the team's Slack channel for human validation before publishing — recommended until your prompt template is battle-tested.
Costs and guardrails
Image generation is billed per image (a few cents depending on model, size and quality), which makes runaway spend more visible than with text — but not impossible: a badly bounded loop regenerating a hundred variants shows up on the bill. Three guardrails: cap the number of images per execution in the workflow; log every generation with its estimated cost (our AI cost tracking method applies as-is); and check the library before regenerating — the same concept illustration can serve ten articles.
On the compliance side, keep prompts away from third-party brands, real people and named artist styles, and check your provider's commercial-use terms — they differ and change.
Verdict
An AI image pipeline in n8n fits in five nodes: an LLM writing the prompt, generation (OpenAI node or HTTP Request), Edit Image for the format variants, storage with metadata, publishing or human validation. Built once, it illustrates every piece of your editorial pipeline for a few cents — and frees the real creative budget for the visuals that deserve a human.
FAQ
Frequently asked questions
Which node should I use to generate an image in n8n?
For OpenAI (DALL·E, gpt-image), the native OpenAI node offers the image generation operation directly: you provide the prompt, it returns the image as binary data. For other providers (Flux by Black Forest Labs, Stability AI, or platforms like Replicate), the HTTP Request node is all you need: a POST with the prompt, then retrieval of the image as binary or via a result URL.
How do you write a good image prompt in an automated way?
By having an LLM write it upstream: a chat node turns the raw subject (article title, product name) into a detailed image prompt — style, composition, lighting, brand constraints — following a fixed template. This two-stage pattern (prompt-writing LLM, then image model) produces far more consistent visuals than an improvised prompt per item.
Can generated images be edited directly in n8n?
Yes, n8n's Edit Image node covers the common operations: resize, crop, add text or a logo, composite several images. For multiple formats (blog banner, Instagram square, thumbnail), a loop over the Edit Image node automatically derives every target format from each generated visual.
Can generated images be used commercially?
Terms vary by provider and evolve: OpenAI and Stability generally grant customers commercial usage rights over outputs, with nuances around protected content. Two production reflexes: check your provider's terms at the time of use, and avoid prompts referencing identifiable brands, people or artist styles.
Bundle FlowKit Complet
€269