> For the complete documentation index, see [llms.txt](https://docs.claid.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.claid.ai/image-editing-api/image-operations/background.md).

# Background

The background section contains all background properties, such as removing the background, blurring the background, and setting the color.

### Background removal

Remove image background. This operation offers both fully automated mode and advanced manual options. Following is a description of `remove` option.

**Possible values:**

<table><thead><tr><th width="282.8488754421951">Value</th><th width="107.46975099615454">Type</th><th width="333.506927402293">Description</th></tr></thead><tbody><tr><td>true</td><td>boolean</td><td>Removes image background.</td></tr><tr><td>false</td><td>boolean</td><td><strong>Default</strong>. Keeps the background of the original image intact.</td></tr><tr><td>{ <br>    "category": "general", <br>    "clipping": true <br>}</td><td>object</td><td>Advanced options for background removal. See detailed description in the table below.</td></tr><tr><td>{ <br>    "selective": { <br>        "object_to_keep": "&#x3C;object>" <br>    }, <br>    "clipping": true <br>}</td><td>object</td><td>Advanced options for background removal. See detailed description in the table below.</td></tr></tbody></table>

Below are advanced options supported by `remove`:

<table><thead><tr><th width="212.33333333333331">Option</th><th width="111">Type</th><th>Description</th></tr></thead><tbody><tr><td>category</td><td>string</td><td><p></p><p>Provides a hint about the nature of object in the foreground for a more accurate result of background removal. Possible values: </p><ul><li><code>"general"</code> is suitable for all objects.</li><li><code>"products"</code> is the advanced category that will have better results with product, grocery and food objects. It is used <strong>by default</strong>.</li><li><code>"cars"</code> is the advanced category that will have better results with automotive objects.</li></ul><p>The <code>category</code> background removal option is used by default and cannot be used together with <code>selective</code>.</p></td></tr><tr><td>selective</td><td>object</td><td>Allows to specify exactly which object should remain on the image, e.g. <code>"food"</code>, <code>"sleeping bag"</code>, <code>"product"</code>, etc. Specifying which object to keep is mandatory and should be short and precise.<br>The Selective background removal is an alternative to the <code>category</code> option and cannot be used together.</td></tr><tr><td>clipping</td><td>boolean</td><td><code>false</code> by default. If <code>true</code>, image is clipped to the foreground object bounds. Resulting image canvas is controlled by the <a href="/pages/7e7BEqodSZKRVIZmqVa7">resizing</a> block. </td></tr></tbody></table>

{% hint style="warning" %}
Please be aware that older versions of the <mark style="color:purple;">`products`</mark> background removal category will be deprecated and automatically updated to the latest version starting January 1, 2025.
{% endhint %}

{% hint style="info" %}
If `clipping` is enabled, `resizing.fit` value is `"crop"/`unspecified, `resizing.width` and `resizing.height`are also unspecified - the resulting cropped image will be scaled to the dimensions of the input image. \
\
If you want to keep the clipped region unchanged, set `resizing.fit` to `"bounds"` and leave `resizing.width` and `resizing.height` unspecified.\
\
You can also upscale or downscale the clipped region in many different ways. See [Resizing](/image-editing-api/image-operations/resizing.md) and [Upscale](/image-editing-api/image-operations/restorations.md#upscale) to learn more.
{% endhint %}

{% tabs %}
{% tab title="Simple background removal" %}
**JSON Request**

```json
"operations": {
    "background": {
        "remove": true
    }
}
```

{% endtab %}

{% tab title="Advanced: category" %}

### Category: Products

#### JSON Request

```json
"operations": {
    "background": {
        "remove": {
            "category": "products"
        }
    }
}
```

![](/files/qG3V6zPVHwwx6i3bD6es)

### Category: Cars

#### JSON Request

```json
"operations": {
    "background": {
        "remove": {
            "category": "cars"
        }
    }
}
```

![](/files/rge1idjSOj9LBOUUgW2p)
{% endtab %}

{% tab title="Advanced: selective" %}

#### JSON Request

```json
"operations": {
    "background": {
        "remove": {
            "selective": {
                "object_to_keep": "bottle"
            }
        }
    }
}
```

<figure><img src="/files/yF8oMWCv0cRxXr3VueFX" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Advanced: clipping and color" %}

#### JSON Request

```json
"operations": {
    "background": {
        "remove": {
            "category": "products",
            "clipping": true
        },
        "color": "transparent"
    }
}
```

![JSON Request](/files/feq7041X7KIDcWzmpkyG)
{% endtab %}
{% endtabs %}

### Background **color**

The image background. You can set transparent background or any color in hexadecimal format.

**Possible values**

| Value       | Type   | Description                                                                                                                                |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| transparent | string | To set transparent background the image format should support an alpha channel (PNG, WEBP or AVIF) otherwise the background will be white. |
| color       | string | Set the color of the background in hexadecimal format. Default is white color.                                                             |

**JSON Request**

{% tabs %}
{% tab title="Transparent" %}

```json
"operations": {
    "background": {
        "remove": {
            "category": "products"
        },
        "color": "transparent"
    }
}
```

![](/files/yKmsZNCVbphf7lEgxPLW)
{% endtab %}

{% tab title="Color" %}

```json
"operations": {
    "background": {
        "remove": {
            "category": "products"
        },
        "color": "#C5C6FF"
    }
}
```

![](/files/DJwXHYqNYeD3ezbKr6cy)
{% endtab %}
{% endtabs %}

### Background blurring

Blur image background. This operation offers both fully automated mode and advanced manual options. Here's a description of `blur` option.

**Possible values:**

<table><thead><tr><th>Value</th><th width="130">Type</th><th>Description</th></tr></thead><tbody><tr><td>true</td><td>boolean</td><td>Blurs image background</td></tr><tr><td>false</td><td>boolean</td><td><strong>Default</strong>. Keeps the background of the original image intact.</td></tr><tr><td><p>{ <br>    "category": "general",<br>    "type": "regular", <br>    "level": "medium" </p><p>}</p></td><td>object</td><td>Advanced options for background blurring. See detailed description in the table below.</td></tr><tr><td>{ <br>    "selective": { <br>        "object_to_keep": "&#x3C;object>" <br>    }, <br>    "type": "regular", <br>    "level": "medium" <br>}</td><td>object</td><td>Advanced options for background blurring. See detailed description in the table below.</td></tr></tbody></table>

Below are advanced options supported by `blur`:

<table><thead><tr><th width="307">Advanced option</th><th width="130">Type</th><th>Description</th></tr></thead><tbody><tr><td>category</td><td>string</td><td><p></p><p>Provides a hint about the nature of object in the foreground for a more accurate result of background blurring. Possible values: </p><ul><li><code>"general"</code> is suitable for all objects and is used by <strong>default</strong>.</li><li><code>"products"</code>is the advanced category that will have better results with product, grocery and food objects.</li><li><code>"cars"</code> is the advanced category that will have better results with automotive objects.</li></ul><p>The <code>category</code> background blur option is used by default and cannot be used together with <code>selective</code>.</p></td></tr><tr><td>selective</td><td>object</td><td>Allows to specify exactly which object should remain on the image unblurred, e.g. <code>"food"</code>, <code>"sleeping bag"</code>, <code>"product"</code>, etc. Specifying which object to keep is mandatory and should be short and precise. <br>The Selective background blur is an alternative to the <code>category</code> option and cannot be used together.</td></tr><tr><td>type</td><td>string</td><td><p>Selects the type of blur to be applied to the background. </p><p>Possible values: </p><ul><li><code>"regular"</code> is for gaussian blur type. Creates an effect of laying a translucent material like vellum on top of the image background. It is used as <strong>default</strong> parameter.</li><li><code>"lens"</code>is for lens blur type with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.</li></ul></td></tr><tr><td>level</td><td>string</td><td><p>Selects the level of blur strength to be applied to the background. Possible values: </p><ul><li><code>"low"</code> is for low blur strength.</li><li><code>"medium"</code> is for medium blur strength. It is used as <strong>default</strong> parameter.</li><li><code>"high"</code> is for high blur strength.</li></ul></td></tr></tbody></table>

**JSON Request**

{% tabs %}
{% tab title="Simple background blurring" %}

```json
"operations": {
    "background": {
        "blur": true
    }
}
```

<figure><img src="/files/iPsbGt2SGmMCLlSBSy4B" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Advanced: category" %}

### Category: Products

####

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "products"
        }
    }
}
```

<figure><img src="/files/40e3CqJzjPKyt6SHMyez" alt=""><figcaption></figcaption></figure>

### Category: Cars

####

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars"
        }
    }
}
```

<figure><img src="/files/qXBbuQ3nRRFnx3sGKtfl" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Advanced: selective" %}

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "selective": {
                "object_to_keep": "bottle"
            }
        }
    }
}
```

{% endtab %}

{% tab title="Advanced: type" %}

### Type: Regular

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "regular"
        }
    }
}
```

<figure><img src="/files/qXBbuQ3nRRFnx3sGKtfl" alt=""><figcaption></figcaption></figure>

### Type: Lens

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "lens"
        }
    }
}
```

<figure><img src="/files/XnA3qiTeDsVMTNWY9JvA" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Advanced: level" %}

### Level: low

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "lens",
            "level": "low"
        }
    }
}
```

<figure><img src="/files/jZ9aLIaQy0VZus2znjSs" alt=""><figcaption></figcaption></figure>

### Level: medium

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "lens",
            "level": "medium"
        }
    }
}
```

<figure><img src="/files/XnA3qiTeDsVMTNWY9JvA" alt=""><figcaption></figcaption></figure>

### Level: high

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "lens",
            "level": "high"
        }
    }
}
```

<figure><img src="/files/UE8rpteHvgMTk69SK4Rq" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}
