# Generate Image

**Action ID:** `generate_image`

## Description

Use AI to generate images from your imagination. Simply describe what you want to see, and watch the AI bring it to life.

## Connection

| Name               | Description                                 | Required | Category |
| ------------------ | ------------------------------------------- | -------- | -------- |
| PixelML Connection | The PixelML connection to call PixelML API. | True     | pixelml  |

## Input Parameters

| Name             | Type     | Required | Default  | Description                                                                   |
| ---------------- | -------- | :------: | -------- | ----------------------------------------------------------------------------- |
| provider         | dropdown |     -    | Runware  | AI provider to use for image generation: Runware, Dall-e, or Stable Diffusion |
| prompt           | string   |     ✓    | -        | Detailed description of what you want to see in the generated image           |
| negative\_prompt | string   |     ✓    | -        | Description of what you don't want in the image                               |
| aspect\_ratio    | dropdown |     -    | 9:16\_HD | Aspect ratio and quality of the generated image                               |
| model\_id        | string   |     -    | null     | Specific model ID to use (Runware only)                                       |
| lora             | array    |     -    | null     | LoRA models to apply for style modification (Runware only)                    |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Generate image node input.",
  "properties": {
    "provider": {
      "default": "Runware",
      "enum": [
        "Runware",
        "Dall-e",
        "Stable Diffusion"
      ],
      "title": "Select provider. Default is Runware",
      "type": "string"
    },
    "prompt": {
      "description": "What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results.",
      "title": "Prompt",
      "type": "string"
    },
    "negative_prompt": {
      "description": "A blurb of text describing what you do not wish to see in the output image.",
      "title": "Negative Prompt",
      "type": "string"
    },
    "aspect_ratio": {
      "default": "9:16_HD",
      "description": "The aspect ratio of the generated image.",
      "enum": [
        "1:1",
        "3:4",
        "4:3",
        "9:16",
        "16:9",
        "1:1_HD",
        "3:4_HD",
        "4:3_HD",
        "9:16_HD",
        "16:9_HD",
        "1:1_FHD",
        "3:4_FHD",
        "4:3_FHD",
        "9:16_FHD",
        "16:9_FHD"
      ],
      "title": "Aspect ratio",
      "type": "string"
    },
    "model_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The model ID to use for the image generation.",
      "title": "Model ID (Runware only)"
    },
    "lora": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Lora model to use for the image generation.",
      "title": "Lora (Runware only)"
    }
  },
  "required": [
    "prompt",
    "negative_prompt"
  ],
  "title": "GenerateImageNodeInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name  | Type   | Description                |
| ----- | ------ | -------------------------- |
| image | string | URL of the generated image |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Generate image node output.",
  "properties": {
    "image": {
      "title": "Image output",
      "type": "string"
    }
  },
  "required": [
    "image"
  ],
  "title": "GenerateImageNodeOutput",
  "type": "object"
}
```

</details>

## How It Works

This node transforms text descriptions into images using advanced AI image generation models. When you provide a detailed prompt describing what you want to create, the AI model interprets your description and generates a corresponding image. The negative prompt helps refine results by specifying unwanted elements, allowing for more precise control over the output. You can choose from different providers (Runware, DALL-E, Stable Diffusion), each with unique characteristics and strengths. Advanced users can specify particular models and apply LoRA modifications for style customization when using Runware.

## Usage Examples

### Example 1: Product Photography

**Input:**

```
provider: "Runware"
prompt: "Professional product photo of a sleek wireless headphone in matte black, floating on white background, studio lighting, high resolution, commercial photography, detailed texture"
negative_prompt: "blurry, low quality, distorted, cluttered background, watermark, text"
aspect_ratio: "1:1_FHD"
```

**Output:**

```
image: "https://storage.pixelml.com/images/headphones-product-abc123.png"
```

### Example 2: Landscape Artwork

**Input:**

```
provider: "Stable Diffusion"
prompt: "Breathtaking mountain landscape at golden hour, snow-capped peaks, alpine lake reflection, dramatic clouds, vibrant sunset colors, photorealistic, 8k quality, nature photography"
negative_prompt: "people, buildings, cars, urban, artificial, cartoonish, oversaturated"
aspect_ratio: "16:9_HD"
```

**Output:**

```
image: "https://storage.pixelml.com/images/mountain-sunset-def456.png"
```

### Example 3: Character Illustration

**Input:**

```
provider: "Dall-e"
prompt: "Fantasy character portrait, elegant elven warrior with silver armor, flowing purple cape, magical aura, detailed face, digital art, concept art style, dramatic lighting"
negative_prompt: "realistic, photograph, blurry, deformed, low quality, text, watermark"
aspect_ratio: "3:4_HD"
```

**Output:**

```
image: "https://storage.pixelml.com/images/elf-warrior-ghi789.png"
```

## Common Use Cases

* **Marketing Content**: Generate custom images for social media posts, advertisements, and promotional materials
* **Product Visualization**: Create product mockups, concept designs, and marketing visuals without expensive photo shoots
* **Blog and Article Illustrations**: Produce unique featured images and article illustrations for content marketing
* **Concept Art**: Develop character designs, environment concepts, and visual references for creative projects
* **E-commerce**: Generate product lifestyle images, background scenes, and category banners
* **Presentation Graphics**: Create custom visuals, diagrams, and illustrations for business presentations
* **Social Media Content**: Produce eye-catching images for Instagram, Facebook, LinkedIn, and other platforms

## Error Handling

| Error Type               | Cause                                            | Solution                                                          |
| ------------------------ | ------------------------------------------------ | ----------------------------------------------------------------- |
| Empty Prompt             | Prompt parameter is missing or empty             | Provide a detailed description of what you want to generate       |
| Invalid Provider         | Selected provider is not available or misspelled | Choose from valid providers: Runware, Dall-e, or Stable Diffusion |
| Content Policy Violation | Prompt contains prohibited content or keywords   | Review and revise prompt to comply with content policies          |
| Generation Timeout       | Image generation taking longer than expected     | Simplify the prompt or try again after a few minutes              |
| Invalid Aspect Ratio     | Aspect ratio not supported by selected provider  | Choose a supported aspect ratio from the available options        |
| Model ID Error           | Specified model\_id doesn't exist (Runware)      | Verify the model ID is correct or leave blank for default         |
| API Connection Failed    | Cannot connect to PixelML API                    | Check your PixelML connection credentials and network status      |

## Notes

* **Provider Selection**: Runware offers fast generation with model flexibility, DALL-E excels at following complex prompts, Stable Diffusion provides artistic control
* **Prompt Engineering**: Be specific about style, lighting, colors, composition, and details. More descriptive prompts yield better results
* **Negative Prompts**: Use negative prompts to avoid common unwanted elements like blur, distortion, watermarks, and low quality
* **Aspect Ratios**: Choose aspect ratios based on use case (1:1 for social media, 16:9 for presentations, 3:4 for portraits)
* **Quality Settings**: HD and FHD suffixes indicate higher resolution. FHD takes longer but produces superior quality for professional use
* **LoRA Models**: Advanced Runware feature that applies specific artistic styles or modifications to the base model
* **Iteration**: Image generation is often iterative. Try different prompts, negative prompts, and settings to achieve desired results
* **Cost Consideration**: Higher resolution (FHD) images consume more credits. Balance quality needs with budget constraints


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agenticflow.ai/reference/nodes/generate_image.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
