# Generate Image V2

**Action ID:** `generate_image_v2`

## 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 Schema

```json
{
  "description": "Generate image node input.",
  "properties": {
    "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"
    },
    "guidance_scale": {
      "default": 8,
      "description": "The guidance scale of the generated image.",
      "exclusiveMinimum": 0,
      "maximum": 15,
      "title": "Guidance scale",
      "type": "number"
    },
    "steps": {
      "default": 20,
      "description": "The number of steps to take in the generated image.",
      "exclusiveMinimum": 0,
      "maximum": 50,
      "title": "Steps",
      "type": "integer"
    },
    "batch_size": {
      "default": 1,
      "description": "The number of images to generate in a batch.",
      "exclusiveMinimum": 0,
      "maximum": 8,
      "title": "Batch size",
      "type": "integer"
    },
    "seed": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The seed to use for the generated image.",
      "title": "Seed"
    },
    "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"
    }
  },
  "required": [
    "prompt",
    "negative_prompt"
  ],
  "title": "GenerateImageV2NodeInput",
  "type": "object"
}
```

## Output Schema

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

## How It Works

This node uses PixelML's advanced AI image generation models to create images from text descriptions. You provide a detailed prompt describing what you want to see, along with a negative prompt specifying what to avoid. The AI processes your description through multiple diffusion steps, guided by the guidance scale parameter, to generate high-quality images. You can control quality through the steps parameter, generate multiple variations with batch\_size, and use seeds for reproducibility.

## Usage Examples

### Example 1: Professional Product Photography

**Input:**

```
prompt: "Professional product photo of a luxury smartwatch on marble surface, studio lighting, soft shadows, elegant composition, 8k, photorealistic"
negative_prompt: "blurry, low quality, distorted, cartoon, illustration, amateur"
guidance_scale: 10
steps: 30
batch_size: 4
aspect_ratio: "1:1_HD"
```

**Output:**

```
images: [
  "https://pixelml.com/output/smartwatch_var1.jpg",
  "https://pixelml.com/output/smartwatch_var2.jpg",
  "https://pixelml.com/output/smartwatch_var3.jpg",
  "https://pixelml.com/output/smartwatch_var4.jpg"
]
```

### Example 2: Social Media Marketing Visual

**Input:**

```
prompt: "Vibrant abstract background with flowing gradient colors from blue to purple, modern, energetic, suitable for Instagram story, vertical format"
negative_prompt: "dull, boring, grayscale, text, watermark, people"
guidance_scale: 8
steps: 25
batch_size: 1
seed: 42
aspect_ratio: "9:16_FHD"
```

**Output:**

```
images: ["https://pixelml.com/output/gradient_background.jpg"]
```

### Example 3: Concept Art for Game Development

**Input:**

```
prompt: "Fantasy medieval castle on mountain peak, dramatic sunset, clouds, epic scale, detailed architecture, concept art style, trending on artstation"
negative_prompt: "modern buildings, cars, people, realistic photo, blurry"
guidance_scale: 12
steps: 40
batch_size: 2
aspect_ratio: "16:9_FHD"
```

**Output:**

```
images: [
  "https://pixelml.com/output/castle_concept1.jpg",
  "https://pixelml.com/output/castle_concept2.jpg"
]
```

## Common Use Cases

* **Marketing Content Creation**: Generate eye-catching visuals for social media posts, advertisements, and promotional materials
* **Product Visualization**: Create product mockups and lifestyle images without expensive photoshoots
* **Website Design**: Generate hero images, backgrounds, and visual assets for web pages and landing pages
* **Concept Art**: Develop initial concept designs for games, films, or creative projects
* **Content Variation Testing**: Generate multiple versions of the same concept to A/B test different visual approaches
* **Rapid Prototyping**: Quickly visualize ideas for presentations, pitches, or client proposals
* **Illustration and Art**: Create unique illustrations, artwork, and creative visuals for various projects

## Error Handling

| Error Type               | Cause                                      | Solution                                                                         |
| ------------------------ | ------------------------------------------ | -------------------------------------------------------------------------------- |
| Empty Prompt             | Prompt field is empty or null              | Provide a descriptive text prompt for the image you want to generate             |
| Invalid Guidance Scale   | Guidance scale outside 0-15 range          | Set guidance scale between 0 and 15 (recommended: 7-12)                          |
| Invalid Steps            | Steps value exceeds maximum of 50          | Reduce steps to 50 or less (recommended: 20-40 for balance of quality and speed) |
| Batch Size Exceeded      | Batch size greater than 8                  | Reduce batch\_size to 8 or fewer images per generation                           |
| Invalid Aspect Ratio     | Aspect ratio value not in supported list   | Choose from supported ratios (1:1, 16:9, 9:16, etc.) with HD or FHD variants     |
| PixelML Connection Error | Invalid or missing PixelML API credentials | Verify your PixelML connection is properly configured with valid API key         |
| Generation Timeout       | Image generation takes too long            | Reduce steps count, batch size, or resolution to speed up generation             |

## Notes

* **Prompt Quality**: More detailed and descriptive prompts produce better results. Include style, lighting, composition, and quality descriptors
* **Negative Prompts**: Use negative prompts to actively exclude unwanted elements like blur, distortion, or specific objects
* **Guidance Scale**: Higher values (10-15) follow prompts more strictly, lower values (3-7) allow more creative freedom
* **Steps vs Speed**: More steps (30-50) produce higher quality but take longer. 20-30 steps balance quality and speed
* **Batch Generation**: Generate multiple variations (batch\_size 2-8) to select the best result for your needs
* **Seed Control**: Use the same seed to reproduce similar images or omit for random variations
* **Aspect Ratios**: HD variants are 1024px, FHD variants are 1920px on the longest side. Choose based on your output needs
* **Processing Time**: Generation typically takes 10-60 seconds depending on steps, batch size, and resolution


---

# 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_v2.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.
