For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

If you're looking to create ai-generated background, please check out the AI Backgrounds feature.

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

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

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

Try it now!

When replacing the background with a solid color, consider also adding an AI Shadow for a more visually pleasing result:

Static Image

To replace the background with a static image, set the either the argument background.imageFile (available only when using the POST endpoint) or background.imageUrl:

(original image)

(static image)

(result)

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

When replacing the background with a static image, consider also adding an AI Shadow for a more visually pleasing result:

Last updated

Was this helpful?