logo
RunComfy
ComfyUIPlaygroundPricing
discord logo
Loading...
ComfyUI>Workflows>FLUX Kontext Face Swap | Seamless Face Replacement

FLUX Kontext Face Swap | Seamless Face Replacement

Workflow Name: RunComfy/FLUX-Kontext-Face-Swap
Workflow ID: 0000...1276
FLUX Kontext Face Swap empowers creatives with accurate, natural face replacement using automatic alignment, refined control, and localized regeneration.

ComfyUI FLUX Kontext Face Swap Workflow

ComfyUI FLUX Kontext Face Swap Workflow | Photoreal Swaps + Localized Refinement
Want to run this workflow?
  • Fully operational workflows
  • No missing nodes or models
  • No manual setups required
  • Features stunning visuals

ComfyUI FLUX Kontext Face Swap Examples

comfyui-flux-kontext-face-swap-workflow-photoreal-swaps-localized-refinement-1276-example_01.webp
comfyui-flux-kontext-face-swap-workflow-photoreal-swaps-localized-refinement-1276-example_02.webp
comfyui-flux-kontext-face-swap-workflow-photoreal-swaps-localized-refinement-1276-example_03.webp
comfyui-flux-kontext-face-swap-workflow-photoreal-swaps-localized-refinement-1276-example_04.webp
comfyui-flux-kontext-face-swap-workflow-photoreal-swaps-localized-refinement-1276-example_05.webp
comfyui-flux-kontext-face-swap-workflow-photoreal-swaps-localized-refinement-1276-example_06.webp

ComfyUI FLUX Kontext Face Swap Description

FLUX Kontext Face Swap workflow for clean, photoreal face replacement

This ComfyUI workflow performs high-quality face replacement by combining an InsightFace-based alignment and paste stage with FLUX.1 image-to-image generation guided by Kontext. It is designed for creators who want fast, reliable swaps with minimal masking and natural skin and hair blending. The pipeline loads a prepared Kontext UNet, applies the Put it here LoRA, and regenerates the local region for a seamless result.

The FLUX Kontext Face Swap workflow takes a base image and a face image, auto-detects and aligns the face, pastes it into the base, scales the composite for FLUX, then refines it with prompt-guided sampling. Results are previewed and saved, with optional knobs to tighten crops or make the swap subtler or stronger.


Key models in Comfyui FLUX Kontext Face Swap workflow

  • FLUX.1-dev: The diffusion backbone that performs image-to-image refinement with Kontext context conditioning. See the official model card for details on architecture and behavior.
  • FLUX autoencoder (AE): The VAE used to encode the composite image to latents and decode sampler outputs back to pixels. Included with FLUX releases.
  • Text encoders CLIP-L and T5-XXL: Provide rich text conditioning for the prompt that focuses the swap region and desired expression. Papers: ,
  • InsightFace: Face detection and landmark analysis for alignment and crop generation.
  • Put it here LoRA: A Kontext-specific LoRA that strongly localizes where FLUX should reconstruct, helping the new face “sit” precisely in the intended area.

How to use Comfyui FLUX Kontext Face Swap workflow

This graph has two main groups that run in sequence: Face transplant prepares a clean composite patch; Ksampler and Output regenerates and polishes it with FLUX.

Face transplant

This group loads your Base Image (LoadImage (#108)) and Face Image (LoadImage (#110)), then finds face regions with AutoCropFaces (#119, #122). The crops and landmarks feed FaceAlign (#121), which warps the source face to match the base pose and scale. Image Paste Face (#125) merges the aligned face into the base while using crop metadata for a tight, realistic overlay. FluxKontextImageScale (#134) then rescales the composite to the exact dimensions Kontext expects, so the downstream VAE encode is lossless and stable.

What to provide:

  • A high-quality base photo with a clearly visible target face.
  • A face image with similar lighting when possible.
  • If the initial crops are off, adjust the auto-crop sensitivity and box size. The note in the canvas reminds that poor results usually improve by relaxing or tightening auto-crop values.

Ksampler and Output

DualCLIPLoader (#8) loads CLIP-L and T5-XXL encoders, and CLIPTextEncode (#6) converts your prompt into conditioning. The prompt is written to focus on restoring the face area and controlling expression; you can edit it to nudge details like smile, hair, or makeup. ConditioningZeroOut (#4) gates text influence so Kontext preserves context outside the swap region, and ReferenceLatent (#3) anchors the generation to the encoded composite. FluxGuidance (#5) balances how much the sampler should obey the reference versus your prompt. The model path runs UNETLoader (#140) with Kontext followed by LoraLoaderModelOnly (#141), which applies the Put it here LoRA. The composite is encoded by VAEEncode (#10), sampled by KSampler (#9), decoded by VAEDecode (#7), previewed, and saved with SaveImage (#19).

What to change:

  • Edit the prompt in CLIPTextEncode to steer expression and local detail.
  • If the swap is too strong or weak, adjust guidance strength and sampler steps.
  • Keep the LoRA applied; it is central to precise placement in FLUX Kontext Face Swap.

Key nodes in Comfyui FLUX Kontext Face Swap workflow

AutoCropFaces (#119 and #122)

Detects faces and produces crop metadata for alignment and pasting. If the face is partially missed or includes hair you do not want, increase crop size slightly or lower detection confidence to pick up more context.

FaceAlign (#121)

Uses InsightFace landmarks to warp the source face onto the base face geometry before merging. Switch the analysis device in FaceAnalysisModels (#120) to GPU when available for faster alignment.

Image Paste Face (#125)

Blends the aligned face into the base image using the crop data. If edges look sharp or color is off, try a slightly larger crop box or reduce any post-prompt aggressiveness so FLUX does less overpainting around the border.

FluxKontextImageScale (#134)

Rescales the composite to the native shape expected by Kontext so the VAE can encode without distortion. Leave this in place to prevent stretching or drift in the refined output.

UNETLoader (#140)

Loads the Kontext-tuned FLUX UNet. Use this together with the LoRA for the intended behavior of FLUX Kontext Face Swap. Changing the checkpoint will noticeably alter skin texture and overall fidelity.

LoraLoaderModelOnly (#141)

Applies Put it here LoRA to localize reconstruction. If the swap drifts or edits spill outside the face, increase the LoRA influence slightly. If the look feels locked, reduce it for more creative freedom.

DualCLIPLoader (#8) and CLIPTextEncode (#6)

Provide text conditioning. Keep prompts short and targeted to the face region and expression. Avoid global style cues if you want to preserve the base image background and clothing.

FluxGuidance (#5)

Balances how much the sampler trusts the reference composite. Raise it to preserve the base composition more tightly, lower it for stronger prompt-driven edits within the face area.


Optional extras

  • For stubborn hairlines or occlusions, prompt explicitly for bangs, sideburns, or “remove hair bun” to let Kontext rebuild a clean edge.
  • Match lighting between face and base when possible. If needed, add a brief prompt hint about warm or cool tone.
  • If crops miss small or rotated faces, start with a larger, higher-resolution base image so detection has more pixels to work with.
  • Keep previews enabled while you iterate. Once satisfied, raise resolution or steps slightly for the final render.

Acknowledgements

  • FLUX team for releasing FLUX.1 models and documentation.
  • InsightFace contributors for robust face detection and alignment.
  • The creator of for precise local guidance that enables accurate placement in the FLUX Kontext Face Swap pipeline.

Want More ComfyUI Workflows?

Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Follow us
  • LinkedIn
  • Facebook
  • Instagram
  • Twitter
Support
  • Discord
  • Email
  • System Status
  • Affiliate
Resources
  • Free ComfyUI Online
  • ComfyUI Guides
  • RunComfy API
  • ComfyUI Tutorials
  • ComfyUI Nodes
  • Learn More
Legal
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.