> For the complete documentation index, see [llms.txt](https://docs.diaflow.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.diaflow.io/workflow-builder/nodes/built-in-tools/image-generation.md).

# Image Generation

## Image Generation

### What does it do?

The **Image Generation** node creates a new image from a text prompt, or edits an existing image. Think of it like a creative studio assistant that turns your brief into ready-to-use visual content.

It is useful for marketing banners, product mockups, campaign visuals, and branded concepts.

#### Smart features

* **Automatic model routing**: Diaflow chooses the right image engine based on the model you select.
* **Text-to-image and image editing in one node**: start from a written prompt, or add one or more reference images.
* **Safe fallbacks for image shape**: if the selected image ratio is not supported, Diaflow falls back to a default ratio.
* **Automatic image count guardrails**: if you request too few or too many images, Diaflow adjusts the number to a supported range.
* **Built-in storage after generation**: generated images are saved in your workspace so later steps can reuse them.
* **Prompt and input mapping from earlier nodes**: you can pull text and image inputs directly from previous workflow steps.

<figure><img src="/files/Tb8i6OtaxLEpQdiTHPD9" alt=""><figcaption></figcaption></figure>

### Real-World Business Value

* Create product marketing visuals from a campaign brief without waiting for manual design drafts.
* Generate multiple ad concepts from one product description for faster approval cycles.
* Edit an existing image to match a new season, offer, or brand direction without starting over.

### Step-by-Step Setup

* In **Model**, choose the image model you want to use.
* In **Prompt**, describe the image clearly, including subject, style, colors, setting, and composition.
* In **Image source**, add an image from an earlier step only if you want to edit or blend existing visuals.
* In **Aspect ratio**, select the format that matches where the image will be used, such as **1:1** for square posts or **16:9** for banners.
* If your selected model supports it, choose the **Image size** or **Resolution** you want.
* If your selected model supports it, set **Number of images** to the number of variations you want.
* Run the workflow and review the generated file in the **Output** tab.

### The Transformation: Before & After

**Before simple campaign brief**

<figure><img src="/files/7eUDs4F3Z7jicCcs6P4g" alt=""><figcaption></figcaption></figure>

**After generated image result**

<figure><img src="/files/YCJnGL4ndB6R8gZJYFv5" alt=""><figcaption></figcaption></figure>

The output is a stored file reference from your workspace. Use that result in later nodes when you need the generated image.

### Tips & Warnings for First-Timers

#### Best practices

* Write specific prompts. Mention the subject, style, lighting, color palette, and layout.
* Choose **Aspect ratio** based on the final destination, such as social, email, ads, or web banners.
* Use **Image source** when you want edits, restyling, or blended visuals.
* Start with one image first. Increase the number only after you confirm the style is right.
* If you need larger output options, choose a model that supports them.

#### Warnings

* Do not expect every model to support the same settings. Some models only create one image per run.
* Do not assume a larger size setting will always apply. Some models ignore higher size choices.
* Do not request too many images in one step unless you really need them. Large batches can take much longer.
* Do not assume the node will always return the exact number of images requested. Some models may return fewer variations.
* Do not use unsupported or broken image files in **Image source**. If Diaflow cannot read the file, the run will fail.
* Do not leave **Prompt** vague or empty. Weak prompts usually lead to weak results or failed runs.
* Do not assume the output is a ready-to-share public image link. The result is a stored file reference for use inside your workflow.
* Do not rely on accidental uploaded files being used as image input. If you want to edit an image, set **Image source** explicitly.
* Do not use prompts that break model content rules. The image may be blocked.
* Do not expect repeated runs with the same prompt to behave the same across all models. Some models may reuse earlier results, while others generate again every time.

### Need help?

* Learn the basics in [How a node works](/getting-started/lets-start-with-the-basics/how-a-node-works.md)
* Build the full flow in [Create a workflow](/workflow-builder/create-a-workflow.md)
* Browse related nodes in [Component List](/workflow-builder/component-list.md)
