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

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.photoroom.com/image-editing-api-plus-plan/static-background.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
