A ComfyUI workflow for inserting a subject (character or stuff) into a new pictures while retaining its feature. It will automatically adapt perspective, light and color tones, and can even change posture according to text prompt. Scroll down for examples.
- Switch the Inpaint Stitch node and the Face Swap Unit, so the face swap model is less confused after stitching.
- Remove dependency on SDXL in the Upscaler Unit. Much better image fidelity and less RAM required, but longer render time if enabled. (Disabled by default.)
- Overhaul the whole workflow logic. Now, it will adhere to the prompt more.
- Add Upscaler Unit to heal pixelating effect. Require SDXL 1.0 (Jugglenaut XI) (https://civitai.com/models/133005/juggernaut-xl)
- Require upscaler model 4x_NMKD-Siax_200k.pth (can be download from ComfyUI Manager in download model section.)
- Change default Inpaint Crop and Inpaint Stitch rescale algorithm to bicubic and bislerp, respectively.
- Fixed some issues with LayerColor: Brightness & Contrast node. (replaced with another version.)
- Fixed CropMask node.
- Added ReActer FaceBooster node.
- Removed Image Sharpen node. It worsens image quality.
- Increase context_expand_factor in Inpaint Crop node. More context will be considered in by the models.
Models required
- Flux1-fill-dev
- Flux1-redux-dev
- InsightFace (inswapper_128) and ReActor.
How to Start
-
Import the workflow to ComfyUI
-
Make sure you install all missing nodes.
-
If you have never used ReActor before, you will need to install it manually. (Installing from ComfyUI Manager alone is NOT sufficient.) If you already got ReActor working before, you can skip to step 11.
-
Go to ComfyUI Manager, click uninstall or disable ReActor from the manager. (This one implements nsfw detector forced by Github and it causes technical problems to several people.)
-
Go to https://codeberg.org/Gourieff/comfyui-reactor-node, scroll down for the Troubleshooting (I) section, follows its instruction RELIGIOUSLY.
-
After installing insightface-0.7.3-cp31X-cp31X-win_amd64.whl (X is your python version), download inswapper_128.onnx from https://huggingface.co/ezioruan/inswapper_128.onnx/tree/main and put it into the folder \ComfyUI\models\insightface (If you don't have one, just create a new folder and rename it to that.)
-
Go to the folder \ComfyUI\models\facerestore_models (create one if you don't have.) and check if you have GFPGANv1.4.onnx and GPEN-BFR-512.onnx there. If you don't have one, you can download from https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models
-
Go to the folder \ComfyUI_windows_portable\python_embeded and type
cmd
in the directory to open command prompt, then typepython.exe -m pip install onnxruntime
-
After finished installing onnxruntime, go to \ComfyUI\custom_nodes and type
cmd
in the file directory to open the command prompt. Entergit clone https://codeberg.org/Gourieff/comfyui-reactor-node.git
and let it install. -
Voila! you have installed ReActor. Take a moment to breath.
-
Now, open the ComfyUI. You can now use the workflow.
-
To use it, load images of the subject, the face (not required if not a person but you need to click disable Face Swap Unit in the Prompt Card), and the destination.
-
Mark the area in the destination image that you want your subject to insert.
-
Type the Prompt.
-
Click Queue.
-
If you are not satisfied with the result, see the Tips notes in some nodes that I found impactful to the results. You will need to experiment on it. There is no universal setting.