logo
RunComfy
  • ComfyUI
  • TrainerNew
  • Models
  • API
  • Pricing
discord logo
ComfyUI>Workflows>Flux Klein Face Swap | Realistic AI Face Editor

Flux Klein Face Swap | Realistic AI Face Editor

Workflow Name: RunComfy/Flux-Klein-Face-Swap
Workflow ID: 0000...1356
This workflow lets you generate photorealistic face replacements with precise control over lighting, emotion, and facial alignment by using FLUX.2 Klein model. Designed for artists and editors, it ensures every swapped face integrates naturally into your image’s style and tone. You can refine outputs with prompts and instantly adjust expressions or angles. Perfect for character design, portrait retouching, and creative image synthesis. Delivers effortless, professional-quality face transformations.

Flux Klein Face Swap for ComfyUI: seamless, prompt‑driven face replacement

Flux Klein Face Swap is a focused ComfyUI workflow that replaces a face in one image with a face from another while preserving pose, lighting, and texture consistency. It builds on FLUX Klein’s unified image generation and editing to deliver realistic swaps that blend naturally with the scene.

This workflow is ideal for portrait editing, character creation, and content refinement. You provide a base image and a face source image, guide the swap with a short prompt, and the Flux Klein Face Swap pipeline aligns geometry, transfers identity, and renders a clean result with optional upscaling.

Key models in Comfyui Flux Klein Face Swap workflow

  • Black Forest Labs FLUX.2‑klein 9B FP8. The core Diffusion Transformer used here for editing and image synthesis. It integrates the new face while keeping scene style and composition stable. Model card
  • FLUX.2‑klein 4B. A lighter alternative that reduces memory and speeds up iteration with slightly lower capacity. Useful for drafts or limited GPUs. Model card
  • Qwen 3 text encoder 8B or 4B. Provides prompt understanding for FLUX 2 so the swap obeys your textual instructions about identity, pose, and style. Files are distributed with the Klein splits. Repository
  • Flux 2 VAE. Encodes images into the latent space FLUX uses and decodes the final latent back to pixels with faithful color and tone. Repository
  • YOLOX object detector and DWPose estimator. Used during preprocessing to locate the face and overall body pose so alignment is natural after the swap. YOLOX DWPose

How to use Comfyui Flux Klein Face Swap workflow

The pipeline flows from inputs to preprocessing, reference conditioning, FLUX sampling, decoding, and optional upscaling. Each stage below names the key UI nodes you will see.

Load inputs with LoadImage (#81) and LoadImage Face Swap Image (#244)

Choose the base photo in LoadImage (#81). This is the scene and clothing you want to keep. Choose the donor portrait in Face Swap Image (#244). This provides the identity to transfer. Pick images with similar head size and general angle for best results. Both images are resized internally to a consistent working resolution.

Detect pose and faces with DWPreprocessor (#267) and normalize with ImageResizeKJv2 (#468)

The preprocessor analyzes the base image to find the head and body keypoints, producing guidance that encodes facial layout and pose. This ensures Flux Klein Face Swap aligns the new face with the original orientation and lighting. The result is resized to match the working dimensions so later steps use consistent geometry. You do not need to supply a mask.

Describe the swap with CLIPTextEncode (#250)

Provide a short instruction that clarifies what should change and what should stay. For example, “replace the head in image 1 with the head from image 2, keep clothing and pose from image 1, match skin tone and lighting.” The text encoder converts your prompt into conditioning that steers the model during sampling. Clear, specific wording yields more faithful swaps.

Build reference conditioning with VAEEncode and ReferenceLatent (#257, #253, #269)

The base image, the face source image, and the pose guidance are each encoded to latents with VAEEncode. ReferenceLatent (#257) first binds the base image to your prompt so style and scene are preserved. ReferenceLatent (#253) injects the donor face’s identity as a reference. ReferenceLatent (#269) adds the detected geometry, which locks in head position and proportions before sampling.

Schedule and sample with FLUX using UNETLoader (#180), Flux2Scheduler (#237), KSamplerSelect (#240), BasicGuider (#277), and SamplerCustomAdvanced (#261)

UNETLoader (#180) loads the FLUX.2‑klein model that performs the actual edit. Flux2Scheduler (#237) sets the denoising schedule at the working width and height so the latent resolution stays consistent. BasicGuider (#277) combines the model with your assembled conditioning and passes it to the sampler. Select a sampler in KSamplerSelect (#240) and keep a fixed seed in RandomNoise (#256) to reproduce results when iterating. SamplerCustomAdvanced (#261) then generates the swapped face latent in a single path without manual masking.

Decode and review with VAEDecode (#251), PreviewImage (#457), and Image Comparer (rgthree) (#452)

VAEDecode (#251) turns the final latent into pixels. Use PreviewImage (#457) to quickly verify identity, skin tone continuity, and hairline edges. Compare the before and after with Image Comparer (rgthree) (#452) to confirm that clothing, pose, and background remain intact. If needed, refine your prompt and re-run to nudge expression or styling.

Upscale and save with SeedVR2VideoUpscaler (#326) and SaveImage (#467)

The upscaler enhances detail and smooths minor seams while respecting the edited identity. Keep color correction consistent across runs to avoid shifts in skin tone. When satisfied, SaveImage (#467) writes the final result with a clear file prefix so batches stay organized. The upscaler is optional if you already work at a high resolution.

Key nodes in Comfyui Flux Klein Face Swap workflow

DWPreprocessor (#267)

Role: detects body and face signals that stabilize alignment. Increase resolution if faces are small in the frame. Enable face and body detection together for portraits that include shoulders or hands to maintain proportion continuity.

ReferenceLatent (#257)

Role: anchors the base image’s style and scene to the prompt so the swap does not drift. If the environment or outfit is changing unintentionally, adjust the base image crop so this reference emphasizes the region you want to preserve.

ReferenceLatent (#253)

Role: injects the donor identity. For strong identity transfer, use a sharp, front-facing donor portrait with neutral expression. Avoid heavy makeup or occlusions that could overfit unwanted features.

ReferenceLatent (#269)

Role: enforces spatial geometry from the detection step so the new face sits naturally on the head and neck. Use when pose or head angle matters. If you want more freedom in expression, choose a base image with the target expression rather than weakening this constraint.

Flux2Scheduler (#237)

Role: defines the denoising path at your working resolution. More steps can refine subtle textures but cost time. Keep width and height inherited from the pipeline to avoid aspect mismatches with the EmptyFlux2LatentImage input.

SamplerCustomAdvanced (#261)

Role: performs the guided denoising using your sampler choice and seed. Use a consistent seed for A/B comparisons and change only one thing at a time, typically the prompt. If results feel overcooked, try a sampler that is less aggressive or reduce the effective denoising by starting from a stronger reference.

SeedVR2VideoUpscaler (#326)

Role: final enhancement and edge cleanup. Raise the target resolution moderately to keep identity stable. If colors shift, enable color correction and keep input noise low to preserve skin tone continuity.

Optional extras

  • Pick input photos with similar head size and orientation for the most convincing Flux Klein Face Swap.
  • Keep prompts short and literal. Mention what to replace, what to keep, and any style notes.
  • Use a fixed seed while exploring prompts, then vary the seed to add subtle expression changes.
  • If skin tone mismatch appears, add a phrase like “match skin tone and lighting” to the prompt.
  • Obtain consent and follow local laws and model licenses when performing any face swap.

Acknowledgements

This workflow implements and builds upon the following works and resources. We gratefully acknowledge @Ai Verse's Flux Klein Face Swap Source workflow for their contributions and maintenance. For authoritative details, please refer to the original documentation and repositories linked below.

Resources

  • Flux Klein/Face Swap Source
    • Docs / Release Notes: @Ai Verse's YouTube

Note: Use of the referenced models, datasets, and code is subject to the respective licenses and terms provided by their authors and maintainers.

Want More ComfyUI Workflows?

ReActor | Fast Face Swap

Professional face swapping toolkit for ComfyUI that enables natural face replacement and enhancement.

Dance Video Transform | Scene Customization & Face Swap

Transform dance videos with scene editing, face-swapping, and motion preservation.

Consistent Character Creator

Create consistent, high-resolution character designs from multiple angles with full control over emotions, lighting, and environments.

Flux Kontext 360 Degree LoRA

Generate immersive 360-style images with depth and spatial control.

Flux PuLID for Face Swapping

Flux PuLID for Face Swapping

Take your face swapping projects to new heights with Flux PuLID.

Product Relighting | Magnific.AI Relight Alternative

Elevate your product photography effortlessly, a top alternative to Magnific.AI Relight.

MV-Adapter | High-Resolution Multi-view Generator

Generate 360-degree views of anything from a single image or description.

Hunyuan Video 1.5 | Fast AI Video Generator

Turn text or images into smooth 1080p videos quickly and easily.

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 2026 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 Models, enabling artists to harness the latest AI tools to create incredible art.