# Image to Image

**Action ID:** `image_to_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 Schema

```json
{
  "description": "Image to image node input.",
  "properties": {
    "source_image": {
      "description": "The image to use as the source for the image to image generation.",
      "title": "Source Image",
      "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"
    },
    "prompt_2": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A second prompt to guide the image generation.",
      "title": "Prompt 2"
    },
    "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": 7.5,
      "description": "The guidance scale of the generated image.",
      "exclusiveMinimum": 0,
      "maximum": 15,
      "title": "Guidance scale",
      "type": "number"
    },
    "image_guidance_scale": {
      "default": 1.5,
      "description": "The guidance scale of the generated image.",
      "exclusiveMinimum": 0,
      "maximum": 15,
      "title": "Image Guidance Scale",
      "type": "number"
    },
    "strength": {
      "default": 0.8,
      "description": "The strength of the source image.",
      "exclusiveMinimum": 0,
      "maximum": 1,
      "title": "Strength",
      "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"
    },
    "width": {
      "default": 0,
      "description": "The width of the generated image.",
      "title": "Width",
      "type": "integer"
    },
    "height": {
      "default": 0,
      "description": "The height of the generated image.",
      "title": "Height",
      "type": "integer"
    }
  },
  "required": [
    "source_image",
    "prompt",
    "negative_prompt"
  ],
  "title": "ImageToImageNodeInput",
  "type": "object"
}
```

## Output Schema

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

## How It Works

This node transforms an existing image into a new variation using AI image generation. The source image serves as a visual reference, and your prompt guides the AI to modify, enhance, or completely reimagine it while maintaining compositional elements. The strength parameter controls how much the AI deviates from the source image (lower values preserve more of the original, higher values allow more creative freedom). The guidance\_scale and image\_guidance\_scale parameters balance adherence to your text prompt versus the source image structure. You can generate multiple variations in a single request using batch\_size.

## Usage Examples

### Example 1: Style Transfer on Product Photo

**Input:**

```
source_image: "https://example.com/products/chair-photo.jpg"
prompt: "modern minimalist chair, white background, professional product photography, studio lighting"
negative_prompt: "blurry, distorted, low quality, shadows"
strength: 0.6
guidance_scale: 7.5
batch_size: 1
```

**Output:**

```
images: ["https://storage.pixelml.com/img2img/styled-chair-001.jpg"]
```

### Example 2: Artistic Transformation

**Input:**

```
source_image: "https://example.com/photos/landscape.jpg"
prompt: "oil painting style, impressionist art, vibrant colors, thick brush strokes, masterpiece"
negative_prompt: "photorealistic, digital, modern, pixelated"
strength: 0.8
guidance_scale: 9.0
image_guidance_scale: 1.5
steps: 30
batch_size: 3
```

**Output:**

```
images: [
  "https://storage.pixelml.com/img2img/painting-var1.jpg",
  "https://storage.pixelml.com/img2img/painting-var2.jpg",
  "https://storage.pixelml.com/img2img/painting-var3.jpg"
]
```

### Example 3: Image Enhancement with Consistency

**Input:**

```
source_image: "https://example.com/sketches/character-sketch.jpg"
prompt: "detailed character illustration, anime style, colorful, high quality, professional digital art"
prompt_2: "full color rendering, cel shading, vibrant palette"
negative_prompt: "sketch, monochrome, unfinished, rough"
strength: 0.7
guidance_scale: 8.0
steps: 25
seed: 42
width: 1024
height: 1024
```

**Output:**

```
images: ["https://storage.pixelml.com/img2img/character-colored.jpg"]
```

## Common Use Cases

* **Product Variations**: Generate multiple styled versions of product photos for A/B testing or different marketing channels
* **Artistic Filters**: Transform photos into different artistic styles (oil painting, watercolor, sketch, cartoon, etc.)
* **Image Enhancement**: Upscale and enhance low-quality images with AI while maintaining the original composition
* **Background Replacement**: Keep the main subject while changing backgrounds, lighting, or environmental elements
* **Character Redesign**: Modify character illustrations, outfits, poses, or art styles while preserving core identity
* **Architectural Rendering**: Transform architectural sketches into photorealistic renderings or different design styles
* **Photo Restoration**: Enhance old or damaged photos by generating improved versions based on the original

## Error Handling

| Error Type          | Cause                                                  | Solution                                                                                 |
| ------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| Invalid Connection  | PixelML connection not configured or expired           | Verify your PixelML connection credentials and ensure the API key is valid               |
| Source Image Error  | source\_image URL is invalid or inaccessible           | Provide a valid, publicly accessible image URL in a supported format                     |
| Empty Prompt        | No prompt provided for image generation                | Provide a descriptive prompt that defines the desired output style and elements          |
| Invalid Strength    | Strength value outside 0-1 range                       | Set strength between 0.01 and 1.0 (lower preserves more of source image)                 |
| Invalid Guidance    | guidance\_scale or image\_guidance\_scale out of range | Keep guidance\_scale and image\_guidance\_scale between 0.1 and 15                       |
| Invalid Steps       | steps parameter exceeds maximum of 50                  | Set steps between 1 and 50 (20-30 is typically sufficient)                               |
| Batch Size Exceeded | batch\_size greater than 8                             | Reduce batch\_size to 8 or fewer images per generation                                   |
| Generation Failed   | AI model failed to generate image                      | Simplify your prompt, adjust strength/guidance parameters, or try different source image |

## Notes

* **Strength Parameter**: Controls transformation intensity. Use 0.3-0.5 for subtle changes, 0.6-0.7 for moderate transformation, 0.8-1.0 for major creative reimagining
* **Guidance Scale**: Higher values (8-12) follow your prompt more strictly, lower values (5-7) allow more AI creativity. Default 7.5 works well for most cases
* **Image Guidance**: Controls how much the composition follows the source image. Higher values preserve layout better, lower values allow more structural changes
* **Steps**: More steps (30-50) produce higher quality but take longer. 20-30 steps offer a good quality/speed balance for most uses
* **Dual Prompts**: Use prompt\_2 to provide additional guidance or emphasize specific aspects not covered in the main prompt
* **Negative Prompts**: Crucial for quality - always specify what you don't want (blurry, distorted, low quality, artifacts, etc.)
* **Seed Consistency**: Use the same seed value to generate reproducible results across multiple runs with same parameters
* **Batch Generation**: Generate multiple variations (batch\_size 2-8) to choose the best result. Each uses the same parameters but produces different outputs


---

# 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/image_to_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.
