Unlock High-Fidelity Face Swapping with Shape Matching Workflow
1. Workflow Overview

This workflow achieves high-fidelity face swapping with shape matching through:
InstantID Technology: Preserves facial features while replacing targets
FLUX Model Enhancement: Improves skin details & resolution
Dynamic Mask System: Precise fusion boundary control
Color Matching: Ensures natural skin tone transitions
Core Models:
DreamShaper XL v2.1 Turbo
: Base generationFLUX Accelerator LoRA
: Speed/quality boosterInstantID ControlNet
: Facial feature bindingRMBG-1.4
: Background removal
2. Components Breakdown
Key Nodes:
InstantID Trio
InstantIDModelLoader
: Loadsip-adapter_instant_id_sdxl
ApplyInstantID
: Performs face feature injectionInstall: Requires
ComfyUI_InstantID
plugin
Dynamic Mask Chain
MaskFastGrow
×3: Progressive mask expansion (params: 16/4 → 32/8 → -32/8)MaskComposite
: Final synthesis (mode: subtract)
Face Shape Matching
CropFaces
: Extracts face regions (scale factor 1.2)WarpFacesBack
: Reintegrates processed faces
Dependencies:
Must download
control_instant_id_sdxl.safetensors
Recommended:
retinaface_resnet50
face detector
3. Workflow Structure
Group Logic:
Group 1: InstantID Face Swap
Input: Source face + Target portrait
Key Nodes:
ApplyInstantID
+ControlNet
Output: Feature-fused latent
Group 2: FLUX Refinement
Uses
FLUX.1-Turbo-Alpha
LoRASampler: Euler+SGM Uniform
Output: 2048x2048 HD face
Group 3: Dynamic Masking
3-stage mask growth → Composite → Edge softening
Visualizer:
MaskPreview+
Group 4: Color Matching
easy imageColorMatch
: ADAIN algorithmPreserves original lighting
4. Inputs & Outputs
Input Parameters:
Required:
Face image (658x877 PNG)
Target image (1780x2048 PNG)
Optional:
Prompt: "woman" (customizable)
Mask expansion (default: 72px)
Outputs:
Final Image:
Resolution: Original + Super-res
Includes: Face comparison slider
Intermediate:
White-background separation (
SplitImageWithAlpha
)Mask previews
5. Notes
Hardware:
Min: RTX 3060 12GB
Recommended: RTX 4090 24GB (for 2048x2048)
Troubleshooting:
Face detection failed
:
→ AdjustDetectFaces
threshold (default 0.5)
→ Ensure face occupies >15% area
Optimization:
Reduce
KSampler
steps (default 10→8)Use
PurgeVRAM
to free memoryDisable live preview for batch processing