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.
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=D3D3D3Static 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:
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.pngLast updated
Was this helpful?

