Background editing API

Change the setting. Keep the subject in focus.

Give users a way to try a different setting for a portrait or product. The Magnt Image API accepts a source photo and a description of the scene you want behind it, then returns the complete edited image.

Create a Magnt API key →

Start with the right request.

Choose a source where the subject is clearly visible. Describe the replacement setting, the direction of light and how the subject should sit in that setting. A grounded scene often needs a surface and a contact shadow, not just a colour behind an object.

  • Describe the supporting surface as well as the backdrop.
  • Match the requested light direction to the source when possible.
  • Inspect edges and shadows at full resolution before accepting the edit.

A prompt to build from

Replace the background of the attached object photo with a warm minimal studio. Preserve the object’s geometry, texture and colours. Place it on a matte beige surface with a soft contact shadow. Light it from the upper left. Do not add props or text.

Example prompt, not a promise of exact results. Review the generated image before publishing.

Send it to the Image API.

POST this JSON to /api/v1/images/generations with your Magnt key in the Authorization header. Replace the image placeholder with your actual JPEG bytes encoded as base64.

{
  "model": "magnt-image-1",
  "prompt": "Replace the background of the attached object photo with a warm minimal studio. Preserve the object’s geometry, texture and colours. Place it on a matte beige surface with a soft contact shadow. Light it from the upper left. Do not add props or text.",
  "images": [
    "data:image/jpeg;base64,YOUR_IMAGE_BASE64"
  ],
  "aspect_ratio": "3:2",
  "resolution": "1K",
  "response_format": "image"
}
Read the complete integration guide →

Review the details that matter.

Look around hair, handles, transparent objects and other difficult boundaries. Also inspect reflections: a new room with an old reflection can look inconsistent. This endpoint performs generative editing, so it is not a pixel-preserving cutout tool. It does not expose a mask input or promise a transparent background.

Make it part of your app.

Offer a small set of scene prompts as starting points and let users refine the description. Send the original attachment with each new request instead of relying on hidden conversation context. Return the image for comparison and let the user decide which version to keep.

Does this return a transparent cutout?

No transparent-cutout contract is provided. The API returns a generated WebP image. Use this workflow for complete background edits, not a guaranteed alpha mask or segmentation output.

Explore related workflows

Your next feature starts with one image.

Create a Magnt key, try your prompt, and bring the result into your app. Each image uses one plan generation or two legacy credits.