> For the complete documentation index, see [llms.txt](https://docs.agenticflow.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agenticflow.ai/reference/nodes/image_compare.md).

# Image Compare

**Action ID:** `image_compare`

## Description

Compare two images side by side.

## Input Parameters

| Name          | Type   | Required | Default | Description                                               |
| ------------- | ------ | :------: | ------- | --------------------------------------------------------- |
| first\_image  | string |     ✓    | -       | First image URL. Supported formats: PNG, JPEG, JPG, WEBP  |
| second\_image | string |     ✓    | -       | Second image URL. Supported formats: PNG, JPEG, JPG, WEBP |

<details>

<summary>View JSON Schema</summary>

**Input Schema**

```json
{
  "description": "Image compare action input.",
  "properties": {
    "first_image": {
      "title": "First image url",
      "type": "string"
    },
    "second_image": {
      "title": "Second image url",
      "type": "string"
    }
  },
  "required": [
    "first_image",
    "second_image"
  ],
  "title": "ImageCompareActionInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name   | Type   | Description                  |
| ------ | ------ | ---------------------------- |
| before | string | The first image URL (before) |
| after  | string | The second image URL (after) |

<details>

<summary>View JSON Schema</summary>

**Output Schema**

```json
{
  "description": "Image compare action output.",
  "properties": {
    "before": {
      "title": "Before",
      "type": "string"
    },
    "after": {
      "title": "After",
      "type": "string"
    }
  },
  "required": [
    "before",
    "after"
  ],
  "title": "ImageCompareActionOutput",
  "type": "object"
}
```

</details>

## How It Works

This node takes two image URLs as input and creates a side-by-side comparison visualization. The images are processed and arranged to allow easy visual comparison between the before (first) and after (second) states. The output provides both images in a structured format that can be displayed or further processed in your workflow.

## Usage Examples

### Example 1: Product Photo Comparison

**Input:**

```
first_image: "https://example.com/product-before.jpg"
second_image: "https://example.com/product-after.jpg"
```

**Output:**

```
before: "https://example.com/product-before.jpg"
after: "https://example.com/product-after.jpg"
```

### Example 2: Image Enhancement Comparison

**Input:**

```
first_image: "https://storage.example.com/original-photo.png"
second_image: "https://storage.example.com/enhanced-photo.png"
```

**Output:**

```
before: "https://storage.example.com/original-photo.png"
after: "https://storage.example.com/enhanced-photo.png"
```

### Example 3: Design Iteration Review

**Input:**

```
first_image: "https://cdn.example.com/design-v1.webp"
second_image: "https://cdn.example.com/design-v2.webp"
```

**Output:**

```
before: "https://cdn.example.com/design-v1.webp"
after: "https://cdn.example.com/design-v2.webp"
```

## Common Use Cases

* **Product Development**: Compare product photos before and after modifications or improvements
* **Image Processing Validation**: Verify the effects of image filters, enhancements, or transformations
* **Design Reviews**: Present design iterations side by side for stakeholder review
* **Quality Assurance**: Compare original and processed images to ensure quality standards
* **A/B Testing**: Create visual comparisons for marketing materials or user interface designs
* **Photo Editing Workflows**: Show before and after results of photo editing operations
* **Documentation**: Create comparison visuals for tutorials, documentation, or training materials

## Error Handling

| Error Type          | Cause                                       | Solution                                                         |
| ------------------- | ------------------------------------------- | ---------------------------------------------------------------- |
| Invalid Image URL   | URL is malformed or inaccessible            | Verify the image URL is valid and publicly accessible            |
| Unsupported Format  | Image format is not PNG, JPEG, JPG, or WEBP | Convert the image to a supported format before comparison        |
| Image Not Found     | The URL returns a 404 error                 | Check that the image exists at the specified URL                 |
| Network Error       | Cannot download the image from the URL      | Verify network connectivity and that the image host is reachable |
| File Size Too Large | Image file exceeds maximum size limit       | Reduce the image file size or resolution                         |
| Empty URL           | Required image URL parameter is missing     | Provide valid URLs for both first\_image and second\_image       |

## Notes

* **Supported Formats**: Ensure both images are in PNG, JPEG, JPG, or WEBP format for best compatibility.
* **Image Accessibility**: Both image URLs must be publicly accessible or within your workflow's accessible storage.
* **Resolution Matching**: For best comparison results, use images with similar aspect ratios and resolutions.
* **Use Cases**: This node is ideal for before/after comparisons, A/B testing, and quality assurance workflows.
* **Output Format**: The output preserves the original image URLs, allowing them to be passed to display nodes or further processing.
* **Performance**: Image comparison is a lightweight operation that primarily organizes the image references rather than processing the images themselves.
