# Static Background

## Overview

The Image Editing API allows you to replace the background of the input image with a new static background.

This new static background can be created using either a solid color or another image.

{% hint style="info" %}
If you're looking to create ai-generated background, please check out the [AI Backgrounds](/image-editing-api-plus-plan/ai-backgrounds.md) feature.
{% endhint %}

### Solid Color

To replace the background with a solid color, set the argument `background.color` to an hexadecimal color code (e.g. `FF0000`):

|        *(original image)*        |     `background.color=D3D3D3`    |     `background.color=ADD8E6`    |
| :------------------------------: | :------------------------------: | :------------------------------: |
| ![](/files/GmHA6SAcV9OnsrLgVfRK) | ![](/files/y0G5o6QuXGdSezpFSGvq) | ![](/files/Bq1qO2jznsCq7nJvFepv) |
| ![](/files/k6OE584HUVQzrNNyHCO5) | ![](/files/t2Mo266ljdiLWMSmYRZl) | ![](/files/StwwlT3v4oasAJiAF3cS) |

If you want to give it a try, here's the code to reproduce the example above:

```bash
curl --request POST \
  --url https://image-api.photoroom.com/v2/edit \
  --header 'x-api-key: YOUR_API_KEY_HERE' \
  --form imageFile=@/path/to/image.png \
  --form padding=0.1 \
  --form background.color=D3D3D3 \
  --output result.png
```

<a href="https://try-api.photoroom.com/?padding=0.1&#x26;background.color=D3D3D3" class="button primary">Try it now!</a>

{% hint style="info" %}
When replacing the background with a solid color, consider also adding an [AI Shadow](/image-editing-api-plus-plan/ai-shadows.md) for a more visually pleasing result:

<img src="/files/iadrEv3rcVbqtUE8UYcr" alt="" data-size="original">
{% endhint %}

### Static Image

To replace the background with a static image, set the either the argument `background.imageFile` (available only when [using the `POST` endpoint](broken://pages/xItuUNPEgAlIrn1G1dmE)) or `background.imageUrl`:

|        *(original image)*        |         *(static image)*         |            *(result)*            |
| :------------------------------: | :------------------------------: | :------------------------------: |
| ![](/files/GmHA6SAcV9OnsrLgVfRK) | ![](/files/AX01H3DMVyAD0sG5EAKr) | ![](/files/2jcWYfH5JqPgT9KvblOh) |
| ![](/files/k6OE584HUVQzrNNyHCO5) | ![](/files/LLsAtL5prnBrqhNexiPq) | ![](/files/t2Ry6jEUm3vUjzxWxtGx) |

If you want to give it a try, here's the code to reproduce the example above:

```bash
curl --request POST \
  --url https://image-api.photoroom.com/v2/edit \
  --header 'x-api-key: YOUR_API_KEY_HERE' \
  --form imageFile=@/path/to/image.png \
  --form padding=0.1 \
  --form background.imageFile=@/path/to/background.png \
  --output result.png
```

{% hint style="info" %}
When replacing the background with a static image, consider also adding an [AI Shadow](/image-editing-api-plus-plan/ai-shadows.md) for a more visually pleasing result:

<img src="/files/6iRFdA4f9gQ3O570bBu4" alt="" data-size="original">
{% endhint %}


---

# 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.photoroom.com/image-editing-api-plus-plan/static-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.
