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.

5 min readSume
All posts

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 as auto. Today the ChatGPT Image and Nano Banana ratio lists include auto; Seedream 4.5's list does not, so give it a ratio from its list.
  • A text-to-image-only model, whose input_references descriptor is {"min": 0, "max": 0}, rejects the photo.
  • The call blocks for up to 30 seconds and returns 200 with the images. A slower generation returns 202 with 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.

From Image API, the Sume API reference, and API pricing, read 2026-09-27.
Edit with a promptCut out the subject
EndpointPOST /v1/imagesPOST /v1/rmbg-1.0/remove
Your photo goes ininput_references, public HTTPS URLsimage_url, one public HTTPS URL
New backgroundDescribed in promptNone: you add it in an editor
What comes backNew images as Sume-hosted, signed URLsA PNG with alpha
Response200 within 30 seconds, or 202 with a jobA job; async is the default mode
PricePer 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_url per job and has no background color option; the result is the cutout alone.

Sources

Related posts

More in Use cases

All Use cases posts

Written by Sume