AI Backgrounds

The Image Editing API allows you to easily create new backgrounds for your images.

This feature works by using Generative AI to dynamically create new backgrounds, that perfectly match the subject of the original picture.

Here's an example of how you can use AI Backgrounds to personalize product images at scale:

How to write a high-quality prompt

To use this feature, you will need to set the argument background.prompt.

The argument background.prompt is a textual description of what the new background should look like.

It can feel challenging to write a good prompt.

However, we have a way to provide you with good examples:

  1. Go to the Photoroom Web App and upload an image for which you'd like to generate a new background

  2. Open “Instant Backgrounds” on the left panel

  • The first 2 results are backgrounds that have been generated specifically for your image, and the prompt is visible below the tile!

  • And if you tap on any of the “scenes”, you'll see the full prompt on top. You can even edit it to see how variations of the prompt would impact the generated background!

If you want a result that looks similar to the 4 options generated by the apps, make sure that, in addition to the background.prompt, you also use the same background.seed than the apps.

Additional Parameters

In addition to background.prompt, the Image Editing API also provides two optional parameters that give you additional control over how the new background will be generated: background.negativePrompt and background.seed.

background.negativePrompt

background.negativePrompt allows you to refine your generated background by specifying elements our AI won’t include in the final image.

For example, if you'd like a wedding-themed background without any flowers in view, consider a background.negativePrompt such as "flowers":

background.seed

If you make several calls to the Image Editing API with the same image and the same prompt, you will notice that it will generate a different background each time.

This is great when you're looking for inspiration, but it might become an issue when you need consistency.

In order to reduce the randomness, you can set a fixed value for the seed that the API's random generator will use. The value of the argument background.seed can be any positive integer.

If you provide a value for background.seed, then the API should produce similar-looking backgrounds for the same prompt.

The iOS, Android and Web versions of PhotoRoom always use the same seeds for the first 4 generated background options they present to the user.

You can use the same values if you want to have results similar to that of the PhotoRoom apps: 117879368, 55994449, 48672244 and 65080068.

Last updated