# Remove Background

**Action ID:** `remove_background`

## Description

Remove the background from an image, leaving only the main subject with a transparent background. This node uses PixelML's background removal technology to intelligently isolate foreground objects.

## 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 from which to remove background. Supported formats: PNG, JPEG, JPG, WEBP |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Remove background node input.",
  "properties": {
    "image_url": {
      "description": "URL of the image from which to remove background",
      "title": "Image url",
      "type": "string",
      "json_schema_extra": {}
    }
  },
  "required": [
    "image_url"
  ],
  "title": "RemovebackgroundNodeInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name  | Type   | Description                                                                 |
| ----- | ------ | --------------------------------------------------------------------------- |
| image | string | URL of the image with background removed and transparent background applied |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Remove background node output.",
  "properties": {
    "image": {
      "title": "Image output",
      "type": "string",
      "json_schema_extra": {}
    }
  },
  "required": [
    "image"
  ],
  "title": "RemovebackgroundNodeOutput",
  "type": "object"
}
```

</details>

## How It Works

This node sends your image to PixelML's background removal service, which uses AI-powered segmentation to identify and separate the foreground subject from the background. The service analyzes the image, detects the main subject (person, object, etc.), and removes the background while preserving the subject with sharp edges. The result is returned as a PNG image with transparency where the background was removed.

## Usage Examples

### Example 1: Remove Background from Product Photo

**Input:**

```
image_url: "https://images.example.com/product_with_bg.jpg"
```

**Output:**

```
image: "https://pixelml-output.example.com/product_nobg_12345.png"
(PNG with transparent background ready for e-commerce)
```

### Example 2: Isolate Person from Photo

**Input:**

```
image_url: "https://storage.example.com/portrait_outdoor.jpg"
```

**Output:**

```
image: "https://pixelml-output.example.com/portrait_isolated_67890.png"
(Transparent background, person preserved with fine hair details)
```

### Example 3: Clean Up Document Photo

**Input:**

```
image_url: "https://cdn.example.com/document_photo.webp"
```

**Output:**

```
image: "https://pixelml-output.example.com/document_clean_11111.png"
(Document isolated with distracting background removed)
```

## Common Use Cases

* **E-Commerce**: Remove backgrounds from product photos for consistent catalog appearance
* **Portrait Editing**: Isolate subjects for creating custom backgrounds or composites
* **Social Media**: Prepare images with transparent backgrounds for better engagement
* **Print Media**: Clean up product shots for brochures and catalogs
* **Photo Compositing**: Extract objects for use in multi-layer compositions
* **Design Assets**: Create transparent-background assets for graphic design projects
* **Professional Headshots**: Prepare profile pictures with clean, professional backgrounds

## 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                |
| No Subject Detected   | Algorithm cannot identify a clear foreground subject | Ensure the image has a clear, identifiable main subject        |
| Ambiguous Subject     | Subject blends too much with background              | Use images with better subject-background contrast             |
| Complex Background    | Background has similar colors to the subject         | Images with distinct subject-background separation work better |
| 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                   |

## Notes

* **Supported Formats**: PNG, JPEG, JPG, and WEBP images are supported as input
* **Output Format**: Result is always PNG with alpha channel for transparency
* **Image Quality**: Works best with images that have clear subject-background separation
* **URL Requirements**: The image URL must be publicly accessible (not behind authentication)
* **Processing Time**: Larger images may take longer to process
* **Edge Quality**: The AI algorithm produces clean, smooth edges on the subject
* **Complex Subjects**: Works well with people, products, animals, and objects
* **Fine Details**: Hair, fur, and fine textures are typically preserved accurately


---

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