Batch Face Swap
Swaps faces / heads between two images in batch by compositing a source face onto a target scene. Semantics: face B is placed onto image A, where B is the source face and A is the target scene.
meitu batch image-face-swap
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: Config file mode (batch face swap)
meitu batch image-face-swap \
--config ./batch.face-swap.yaml \
--output-dir ./outputs \
--json
# Scenario 2: High-concurrency batch face swap
meitu batch image-face-swap \
--config ./batch.face-swap.yaml \
--output-dir ./outputs \
--concurrency 3 \
--max-retries 1 \
--json-output ./result.jsonConfig File Example
version: 1
defaults:
outputDir: ./outputs
items:
- scene: ./scenes/man_in_suit.jpg
head: ./faces/person1.jpg
prompt: Natural face swap blending
- scene: ./scenes/woman_dress.jpg
head: ./faces/person2.jpg
prompt: Natural face swap blending
- scene: ./scenes/group_photo.jpg
head: ./faces/person3.jpg
prompt: Fine face swap, keep it naturalParameter Reference
| Parameter | Required | Description |
|---|---|---|
--output-dir | Yes | Output directory |
--config | Yes | Path to YAML/JSON config file (config file is required for batch face swap) |
--concurrency | No | Type: number; Default: 3; Number of concurrent executions |
--max-retries | No | Type: number; Default: 0; Number of retries on failure |
--skip-exist | No | Skip existing output files |
--dry-run | No | Preview the plan without executing |
--no-progress | No | Disable per-task progress logging |
--json | No | Output results in JSON format |
--json-output | No | Write results to a specified JSON file |
--skill-name | No | Skill name attributed on the server side |
Config Item Reference
| Config Item | Required | Description |
|---|---|---|
scene | Yes | Path to the target scene image (base image) |
head | Yes | Path to the source face image (the face provider) |
prompt | Yes | Description of the desired face swap effect |