Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Background removal and generation

Use background.remove to cut out the main subject.

You can keep transparency, apply a flat color, replace the background, or generate a new one.

Background removal

{
    "background": {
        "remove": "auto",
        "color": "#FFFFFF"
    }
}

Parameters

Parameter
Description

remove

Controls the background removal mode. Supported values are auto, v2, human, item, and generative.

prompt

Text instruction used with remove: "generative". Describe what should stay in the foreground.

color

Controls the output background color. Use auto, a hex color like #FFFFFF, or transparent.

replace

URL of a background image for simple replacement. This does not generate new shadows or reflections.

auto is the default mode.

Use human for portraits.

Use item for products and objects.

Use generative when the image has multiple relevant foreground elements and you want the prompt to guide what stays.

Let's check some examples.

Click the result image to compare it with the source.

Prompt-based background removal

Use prompt-based removal when auto keeps too much, removes too much, or misses related foreground objects.

Keep the prompt short and focused on what should remain.

You can combine this with color or replace when you do not want a transparent result.

For image preparation tips, see Remove BG recommendation.

Item cropping

You can combine background removal, padding, and item crop to center a subject inside a fixed canvas.

Result

Background generation

Background generation improves product photos without a manual photo shoot.

It removes the original background, places the subject on the canvas, and generates a new scene around it.

Parameters

Parameter
Description

description

Text prompt describing the scene.

item_area_percentage

Float from 0 to 1 that controls how much of the final image the item occupies. 0.85 means 85%.

sample_num

Random seed for the generated image. If you omit it, results vary between runs.

color

Converts the generated background to black and white, then tints it with the given RGB array. Example: [255,255,255].

background_url

URL of an image blended with the generated background for more consistent outputs.

Without sample_num:

You can also set the output size:

When specifying a color:

Last updated