# Outpainting

**Action ID:** `outpainting`

## Description

Expand an image beyond its original boundaries using AI-generated content. This node extends images in specified directions (vertical or horizontal) by intelligently generating new content that matches the original image's style and composition.

## Provider

**PixelML**

## Connection

| Name               | Description                                 | Required | Category  |
| ------------------ | ------------------------------------------- | :------: | --------- |
| PixelML Connection | The PixelML connection to call PixelML API. |     ✓    | pixel\_ml |

## Input Parameters

| Name       | Type   | Required | Default  | Description                                                         |
| ---------- | ------ | :------: | -------- | ------------------------------------------------------------------- |
| image\_url | string |     ✓    | -        | URL of the image to extend. Supported formats: PNG, JPEG, JPG, WEBP |
| direction  | enum   |     -    | vertical | Direction to expand the image (vertical or horizontal)              |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Outpainting node input.",
  "properties": {
    "image_url": {
      "description": "URL of the image to extend",
      "title": "Image url",
      "type": "string",
      "json_schema_extra": {}
    },
    "direction": {
      "default": "vertical",
      "description": "Direction to expand the image",
      "enum": [
        "vertical",
        "horizontal"
      ],
      "title": "Direction to expand",
      "type": "string",
      "json_schema_extra": {}
    }
  },
  "required": [
    "image_url"
  ],
  "title": "OutpaintingNodeInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name   | Type  | Description                                                    |
| ------ | ----- | -------------------------------------------------------------- |
| images | array | List of URLs of the outpainted images with extended boundaries |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Outpainting node output.",
  "properties": {
    "images": {
      "description": "List of outpainted images",
      "title": "Image output",
      "type": "array",
      "items": {
        "type": "string",
        "json_schema_extra": {}
      }
    }
  },
  "required": [
    "images"
  ],
  "title": "OutpaintingNodeOutput",
  "type": "object"
}
```

</details>

## How It Works

This node extends your image canvas by intelligently generating new content using PixelML's AI algorithms. The service analyzes the original image content, composition, colors, and artistic elements, then generates additional pixels in the specified direction. For vertical expansion, content is added above and/or below the original image. For horizontal expansion, content is added to the left and/or right. The AI maintains visual consistency, style matching, and compositional balance with the original image.

## Usage Examples

### Example 1: Vertical Expansion of Landscape

**Input:**

```
image_url: "https://images.example.com/landscape.jpg"
direction: "vertical"
```

**Output:**

```
images: [
  "https://pixelml-output.example.com/landscape_expanded_v_12345.png"
]
(Image expanded vertically with additional sky and foreground)
```

### Example 2: Horizontal Expansion of Portrait

**Input:**

```
image_url: "https://storage.example.com/portrait.jpg"
direction: "horizontal"
```

**Output:**

```
images: [
  "https://pixelml-output.example.com/portrait_expanded_h_67890.png"
]
(Image expanded horizontally for wider composition)
```

### Example 3: Expand Still Life Photo

**Input:**

```
image_url: "https://cdn.example.com/still_life.webp"
direction: "vertical"
```

**Output:**

```
images: [
  "https://pixelml-output.example.com/still_life_expanded_11111.png",
  "https://pixelml-output.example.com/still_life_expanded_var2_22222.png"
]
(Multiple variations of vertically expanded composition)
```

## Common Use Cases

* **Social Media Optimization**: Extend images to fit different platform aspect ratios
* **Canvas Expansion**: Add space around subjects for better composition
* **Poster Design**: Extend artwork for printing at different sizes
* **Website Headers**: Create wider banner images from portrait originals
* **Video Backgrounds**: Expand images to fill screen dimensions
* **Photo Restoration**: Fill missing edges of damaged vintage photos
* **Artistic Creation**: Generate creative extensions of existing artwork

## Error Handling

| Error Type            | Cause                                             | Solution                                                     |
| --------------------- | ------------------------------------------------- | ------------------------------------------------------------ |
| Invalid Image URL     | Image URL is malformed or inaccessible            | Verify the URL is valid and the image is publicly accessible |
| Unsupported Format    | Image format is not PNG, JPEG, JPG, or WEBP       | Convert the image to a supported format                      |
| Corrupted Image       | Image file is corrupted or incomplete             | Try with a different or fresh copy of the image              |
| Invalid Direction     | Direction value is not "vertical" or "horizontal" | Use only vertical or horizontal for the direction parameter  |
| Complex Content       | Image has overly complex or abstract content      | Simpler, more recognizable content produces better results   |
| Insufficient Context  | Image is too small for meaningful expansion       | Use larger source images for better outpainting results      |
| PixelML Service Error | PixelML API is unavailable or returning errors    | Check your PixelML connection and try again later            |
| Authentication Error  | Invalid or expired PixelML credentials            | Verify your PixelML connection configuration                 |
| Timeout Error         | Request took too long to process                  | Try with a smaller image or simpler content                  |

## Notes

* **Supported Formats**: PNG, JPEG, JPG, and WEBP images are supported
* **Expansion Amount**: The expansion amount is determined by PixelML's algorithm based on image dimensions
* **Multiple Outputs**: The node may return multiple variations for selection
* **Content Generation**: AI generates new content matching the original image's style
* **Aspect Ratio Change**: Expansion changes the original aspect ratio; plan accordingly
* **Processing Time**: Outpainting operations may take time depending on image size
* **Best Results**: Works best with clear subjects, recognizable scenes, or artistic images
* **Output Format**: Results are typically returned as PNG URLs


---

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