Current location: Home> ComfyUI Tutorial> How to change faces using ComfyUI

How to change faces using ComfyUI

Author: LoRA Time: 24 Mar 2025

1. What is ComfyUI Reactor?

ComfyUI Reactor is a quick and easy face-changing expansion node for ComfyUI. It utilizes multiple models to facilitate face detection, face swaps and recovery while maintaining ease of use.

2. How to use Reactor in ComfyUI?

1. Set up the image

First, you need to select "Source Image" - consider it as a face donor. Then, select your "Input Image" – this is the lucky receiver of your new face.

Guide to Setting Up Source and Input Images for Fast Face Exchange with ReActor in ComfyUI

2. Face change model

We have downloaded the inswapper_128.onnx model, i.e. the pre-trained model inswapper_128.onnx, provided by InsightFace.

3. Face detection

Face detection is like having a digital detective that can recognize faces in both source and input images. We have all kinds of detectives - resnet50, mobile0.25, YOLOv5l and YOLOv5n. But our first choice is retinaface_resnet50. It performs very well.

4. Face recovery

Here you can choose a model for facial repair. Some people prefer GF PGN, but give Code Forer a try - it's great too!

5. Face restoration visibility and CodeFormer weight (fidelity)

These settings are like adjusting the guitar. The default setting is Visibility 1.00 and CodeFormer weight 0.75, but don't hesitate to try it out and see what tunes you can create.

6. Test gender? Maybe not

The Detection Gender option determines whether you want the model to determine the gender in the image. ReActors exchange faces only when a given condition is met. In my experience, setting it to No will have a good effect. Maybe it's like telling the model, "Everyone's eyes are focused on the face, model baby!"

ReActor (quick face change) configuration instructions in ComfyUI

7. Introduce the face index

Face index helps the system recognize each face in the image. Faces are marked from left to right, from top to bottom in their respective images. In this way, the system can know exactly who is who.

1. Set up a single face change

Just exchange a face? Simple! The indexes of both the source face and the input face are 0.

How to set face swap index using ReActor in ComfyUI

2. Set multiple faces

Now, if you are ambitious and want to swap multiple faces, you can follow these steps:

Swap multiple faces in separate images
 1. When processing the character on the left in the animation, set both the source and input surface index to 0. This will instruct Reactor to "replace the left-hand character in the input image with the source image".
2. For characters on the right, adjust the source index to 0 and the input face index to 1. This will instruct Reactor to "replace the right character in the input image with the source image".
3. Remember that if each character is in a separate image, you need two sets of Reactor nodes. 

How to set face index using ReActor in ComfyUI to exchange multiple faces with different source images

Multiple faces exchange in one picture
 1. If you have an image with two characters, a Reactor node will solve the problem.
2. The interesting place is here. You can mix and match faces. Suppose you want to swap the second face in the input image (index = 1) with the first face in the source image (index = 0) and you want to swap the first face in the input image (index = 0) with the second face in the source image (index = 1). All you need to do is set your index like this: Source - 0,1; Input - 1,0. 

How to set face indexing in ComfyUI to swap multiple faces with a single source image

3. If necessary, you can use smart frame interpolation

Here is a practical trick - consider using a frame interpolator. Imagine it's a time machine for video frames. It produces miracles by reducing the number of frames that need to be processed initially and then rebuilding them well later. This is especially useful if you have to sacrifice video quality in order to speed up processing. Think of this step as a magic wand to help you regain some of the lost clarity and detail.

Enhance video or animation using the Frame Interpoler in ComfyUI

4. Adjust the size and optimize as needed

You can also resize the video image before passing it to the interpoler. Although it is difficult to achieve the quality of the original file, it is better than nothing.

Use the resize feature in ComfyUI to resize videos or animations