How to change the background of a photo with AI
Give an AI image model your photo and a prompt that names the new background, or cut the subject out first. How to do both with the Sume API.

To change the background of a photo with AI, send the photo to an image model that edits from reference images, with a prompt that names the new background and says the subject must stay the same. If you would rather the subject not be redrawn, cut it out with a background remover and place the transparent cutout on a new background in an image editor.
With Sume, the edit is one POST /v1/images call and the cutout is a Sume RMBG 1.0 job. The details below come from the Image API docs, the Image 1.0 page, and the OpenAPI document behind the Sume API reference, read on 2026-09-27.
How do I change the background with a prompt?
Send the photo as an input_references entry to POST /v1/images, pick a model that edits from references, and describe the new background in prompt. Sume's own docs example of this edit uses the prompt "Keep the product identical; swap the background to a soft daylight studio". It is written for Image 1.0, which is retiring, so the example below sends the same prompt to the Image API. Four things to know:
- The photo must sit at a public HTTPS URL. Localhost, private-network, and non-HTTPS URLs are rejected before submission.
aspect_ratio: "auto"matches the output to the reference, and leaving the field out is not the same asauto. Today the ChatGPT Image and Nano Banana ratio lists includeauto; Seedream 4.5's list does not, so give it a ratio from its list.- A text-to-image-only model, whose
input_referencesdescriptor is{"min": 0, "max": 0}, rejects the photo. - The call blocks for up to 30 seconds and returns
200with the images. A slower generation returns202with a job to poll.
curl -X POST "https://api.sume.com/v1/images" \
-H "Authorization: Bearer $SUME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-image-2.5",
"prompt": "Keep the product identical; swap the background to a soft daylight studio",
"aspect_ratio": "auto",
"input_references": [
{ "type": "image_url", "image_url": { "url": "https://example.com/product.png" } }
]
}'What should the prompt say?
Say what stays, then describe the new background in concrete terms. The docs example does both in one line: "Keep the product identical" is the constraint, and "a soft daylight studio" is the new scene. A few prompts in the same shape:
- Portrait: "Keep the person, pose, and clothing the same; replace the background with a quiet city street at dusk, softly out of focus."
- Product: "Keep the bottle and its label unchanged; place it on a white marble counter in morning window light."
- Pet: "Keep the dog exactly as it is; change the background to a grassy park on a sunny day."
Will the subject stay exactly the same?
Not guaranteed. The model generates a new picture from your photo and prompt, so faces, logos, and small text can come back different. Compare every result with the original before you use it.
When the subject should stay as shot, remove the background instead. Send the photo's public HTTPS image_url to POST /v1/rmbg-1.0/remove; the completed job returns a PNG with an alpha channel, background removed. Put that cutout on your new background in any image editor that supports layers. Remove background API covers the job in full, and white background product photos applies it to marketplace shots.
Should I edit with a prompt or cut out the subject?
Use the edit when a redrawn subject is acceptable and you want the model to build the scene. Use the cutout when the subject has to stay as shot and you will supply the background.
| Edit with a prompt | Cut out the subject | |
|---|---|---|
| Endpoint | POST /v1/images | POST /v1/rmbg-1.0/remove |
| Your photo goes in | input_references, public HTTPS URLs | image_url, one public HTTPS URL |
| New background | Described in prompt | None: you add it in an editor |
| What comes back | New images as Sume-hosted, signed URLs | A PNG with alpha |
| Response | 200 within 30 seconds, or 202 with a job | A job; async is the default mode |
| Price | Per completed image at the model's catalog rate, plus a 5.5% agent fee by default | $0.0225 per image, plus a 5.5% agent fee by default |
What are the limits?
- Both routes take URLs, not file bytes: the photo must be reachable at a public HTTPS URL.
- Image API billing is all-or-nothing: a completed generation is billed in full, and a failed or cancelled one is not billed.
- Image API result URLs are signed. Download the files you want to keep.
- RMBG 1.0 takes one
image_urlper job and has no background color option; the result is the cutout alone.
Sources
Related posts
More in Use cases
- Faceless video API: voiceover, B-roll, music, and captions
Build a faceless video with the Sume API: TTS narration as the spine, generated B-roll, a Sume-hosted music bed, and captions timed from TTS words.
- Generate music for a video with AI, then fit it to the cut
To generate music for a video with AI, describe the cut in a music brief, send a still from it, ask for its length, then fit the track to the video.
- Hook variations for UGC ads: swap the hook, reuse the body
Make UGC ad hook variations by changing only the opening: one Timeline render per hook over the same body clips and voice, checked free first.
- How long should an ad be? Video ad lengths by platform
There is no single right length: each platform publishes its own. YouTube bumpers are 6 s, and Facebook plays in-stream ads of 15 s or less in full.
Written by Sume