Put a face onto a picture: ReActor
Lesson "face-swap", in the group Faces and characters of the lesson list. Steps: 9.
Consent first
Only someone who agrees may be shown this way: yourself, a person who gave permission, or an invented character. Obtain consent before using a real person's likeness and permission for the source material, and follow local law. Do not put a real person's likeness into explicit content; exclude anyone who is or appears under 18; do not pass a person off as saying or doing what they did not. See Content rules.
What you will be able to do
You build a graph that puts a face from one picture onto a person in another picture you already have.
What you need
- It goes on from Restore a face in an old picture: ReActor. The card says so; it is a hint, not a lock.
- Node packs: ComfyUI-ReActor. You install them in ComfyUI yourself, then choose Sync ▸ Sync now. Until then the card says the lesson does not fit and names the pack.
- Model files the lesson checks:
- for
face_restore_modelof ReActor 🌌 Fast Face Swap: a model, notnone.
- for
- Nodes: Load Image, ReActor 🌌 Fast Face Swap, Save Image / Preview Image.
- The app downloads and installs nothing. The step texts below say which files and folders, and which ComfyUI template names them.
The steps
The words of each step, as the lesson shows them. Node names are in bold.
First, about faces (reading)
Only someone who agrees may be shown this way: yourself, a person who gave permission, or an invented character. Obtain consent before using a real person's likeness and permission for the source material, and follow local law. Do not put a real person's likeness into explicit content; exclude anyone who is or appears under 18; do not pass a person off as saying or doing what they did not. This lesson teaches technique.
ReActor finds a face in one picture and puts it onto a face in another. The example: a character you generated gets the face from your own photo, or your own face goes into a picture you drew.
The nodes of this lesson come from the ComfyUI-ReActor pack. A pack runs other people's code on your computer: install it yourself through ComfyUI's manager, and only a pack you trust. The pack has its own detector that refuses explicit pictures.
The lesson builds the graph from an empty canvas: "File ▸ New project".
Load the picture to change
Add a Load Image node and choose the picture whose face is replaced in its
imagefield.Load the face
Add a Load Image node and choose the picture with the face in its
imagefield. It must be another file than the first.A frontal, sharp face works best. If either picture has several faces, the node takes them in order from the left; its fields
input_faces_indexandsource_faces_indexchoose which.Add the swap
Add a ReActor 🌌 Fast Face Swap node. Connect the picture from Load Image to its
input_imageinput and the face from Load Image to itssource_imageinput.In
swap_modelchooseinswapper_128.onnx; the pack downloads it to models/insightface when it is installed. Setfacedetectiontoretinaface_resnet50, the most careful way to find faces.Sharpen the new face
The swap model works at a small size, so the new face comes out soft. In ReActor 🌌 Fast Face Swap choose a restoration model in
face_restore_model, for examplecodeformer-v0.1.0.pth, setface_restore_visibilityto 1 andcodeformer_weightto 0.5.These do what the lesson "Restore a face in an old picture: ReActor" explains.
Save the result
Add a Save Image node and connect the
SWAPPED_IMAGEoutput of ReActor 🌌 Fast Face Swap to itsimagesinput.Swap, adapter or LoRA (reading)
A swap changes a picture that already exists: the pose, the light and the clothes stay, only the face is new. An adapter such as IP-Adapter FaceID draws a new picture around the face. A LoRA trained on the character holds face, body and clothes in every picture.
The built-in knowledge "Identity: adapter, LoRA or swap" compares them.
When the result is bad (reading)
- The face looks pasted on: lower
face_restore_visibilityto 0.7, or tryGFPGANv1.4.pth. - The wrong face is changed: set
input_faces_index. - The skin tone differs: pick a source photo with similar light.
- Nothing happens: no face was found; use a larger, frontal face.
A face that is small or broken in a picture you drew is repaired in "Fixing faces and hands with a detailer".
The InsightFace models the swap uses are for non-commercial use only.
- The face looks pasted on: lower
The graph is ready (reading)
Save the graph with "File ▸ Save workflow for ComfyUI…", open the file in ComfyUI and run it there. This app runs nothing in ComfyUI itself.
Nothing made this way may pass a person off as saying or doing what they did not.
What the lesson checks
A reading step is done when you press Got it, next. A doing step ticks itself off when the canvas holds:
- Step 2, Load the picture to change:
- a Load Image node.
imageof Load Image (picture to change): a value is chosen.
- Step 3, Load the face:
- a Load Image node.
imageof Load Image (face) is not the same file asimageof Load Image (picture to change).
- Step 4, Add the swap:
- a ReActor 🌌 Fast Face Swap node.
IMAGEof Load Image (picture to change) intoinput_imageof ReActor 🌌 Fast Face Swap.IMAGEof Load Image (face) intosource_imageof ReActor 🌌 Fast Face Swap.swap_modelof ReActor 🌌 Fast Face Swap: a value is chosen.facedetectionof ReActor 🌌 Fast Face Swap isretinaface_resnet50.
- Step 5, Sharpen the new face:
face_restore_modelof ReActor 🌌 Fast Face Swap holds a file and notnone(capitals, dots and dashes do not matter).face_restore_visibilityof ReActor 🌌 Fast Face Swap is from 0.5 to 1; Do this for me sets 1.codeformer_weightof ReActor 🌌 Fast Face Swap is from 0.3 to 0.8; Do this for me sets 0.5.
- Step 6, Save the result:
- a Save Image or Preview Image node.
SWAPPED_IMAGEof ReActor 🌌 Fast Face Swap intoimagesof Save Image or Preview Image.