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 ./output

Parameter Reference

ParameterRequiredDescription
--image_urlYesAlias: --image; Type: string; The image to replace background for
--promptYesType: string; Target background description
--download-dirNoType: string; Download the result file to the specified local directory
--outputNoType: string[]; Specify output file paths, mapped in order of data.result.urls
--jsonNoOutput results in JSON format for easy parsing by scripts or agents