image-background-replace
Replaces image background/scene while preserving foreground subject, covering product scene swap, portrait background change, ID photo background color (white/blue/red), and AI-generated target scenes. Cannot output transparent backgrounds.
meitu image-background-replace
Usage Examples
# Scenario 1: White background
meitu image-background-replace \
--image_url ./sample.jpg \
--prompt "white background" \
--json
# Scenario 2: Specify target background
meitu image-background-replace \
--image_url ./sample.jpg \
--prompt "sunset beach, warm tones" \
--json
# Scenario 3: Full parameters + download result
meitu image-background-replace \
--image_url ./sample.jpg \
--prompt "sunset beach, warm tones" \
--json \
--download-dir ./outputParameter Reference
| Parameter | Required | Description |
|---|---|---|
--image_url | Yes | Alias: --image; Type: string; The image to replace background for |
--prompt | Yes | Type: string; Target background description |
--download-dir | No | Type: string; Download the result file to the specified local directory |
--output | No | Type: string[]; Specify output file paths, mapped in order of data.result.urls |
--json | No | Output results in JSON format for easy parsing by scripts or agents |