Batch Background Replacement

Batch replace image backgrounds/scenes while preserving foreground subjects, supporting text-based target background description.

meitu batch image-background-replace

Note: Batch processing is available from meitu-cli v2.1.1 onward. Please upgrade if you're on an older version.

Usage Examples

# Scenario 1: Directory scan mode
meitu batch image-background-replace \
  --input-dir ./images \
  --output-dir ./outputs \
  --prompt "white background" \
  --json

# Scenario 2: Config file mode
meitu batch image-background-replace \
  --config ./batch.image-background-replace.yaml \
  --output-dir ./outputs \
  --json

Config File Example

version: 1
defaults:
  outputDir: ./outputs
items:
  - input: ./images/product1.jpg
    prompt: white e-commerce background
  - input: ./images/person1.jpg
    prompt: city night scene background

Parameter Reference

ParameterRequiredDescription
--input-dirNoInput directory, recursively scans image files
--output-dirYesOutput directory
--configNoPath to YAML/JSON config file
--promptYesType: string; Target background description. Required in directory scan mode; in config file mode, serves as default and can be overridden per item
--concurrencyNoType: number; Default: 3; Number of concurrent executions
--max-retriesNoType: number; Default: 0; Number of retries on failure
--skip-existNoSkip existing output files
--dry-runNoPreview the plan without executing
--no-progressNoDisable per-task progress logging
--jsonNoOutput results in JSON format
--json-outputNoWrite results to a specified JSON file
--skill-nameNoSkill name attributed on the server side