Who is this API for?
The Image Editing API enables anyone to easily create high-quality images.
This is what a typical call to the API looks like:
curl --request POST \
--url https://image-api.photoroom.com/v2/edit \
--header 'x-api-key: YOUR_API_KEY' \
--form imageFile=@/absolute/path/to/image.jpg \
--form removeBackground=true \
--form background.color=FFFFFF \
--form padding=0.15 \
--form shadow.mode=ai.soft \
--output result-post-endpoint.pngAnd these are examples of results that this API call produces:
(original image)
(result image)






Let's go over the parameters of this API call.
imageFile=@/absolute/path/to/image.jpg
imageFile=@/absolute/path/to/image.jpgThis parameter represents the input image that you want to edit.
This image can be provided either:
as a file, using the parameter
imageFileas a URL, using the parameter
imageUrl
More details about maximum file size, resolution and image formats are available here.
removeBackground=true
removeBackground=trueThis parameter specifies that the background of the input image should be removed.
background.color=FFFFFF
background.color=FFFFFFThis parameter creates a new background that consists of a white solid color.
Alternatively to using a solid color, you can also opt for:
having a transparent background (this is this the default behavior)
using a static image
creating an AI Background
padding=0.15
padding=0.15This parameter adds 15% of padding around the subject, for a more visually pleasing result.
The positioning of the subject in the result image is fully customizable, you can read more about it here.
shadow.mode=ai.soft
shadow.mode=ai.softThis parameter adds a realistic shadow to the subject, which helps the result image look more natural.
The look of the shadow can be customized, you can read more about it here.
Last updated
Was this helpful?