Face AutoFit Double @ CHAOS
The node that frames dialogue scenes
- image_L
- mask_L
- image_R
- mask_R
- image
- mask_L
- mask_R
- mask_combined
- gender_L
- gender_R
- mode_code
Face AutoFit Double is the same composition trick as its single variant, but for two people - and that changes the job in a way that's worth understanding before you wire it up. Instead of just placing one person on a properly-framed canvas, it has to place two people at sensible relative sizes and positions so the result reads as a conversation or a shared scene rather than two headshots glued together. It's the node you reach for when you want a "two characters talking" or "couple portrait" image with the faces you already generated, laid out on a canvas that doesn't look accidental.
What it's for
In the pack's intended pipeline it sits right before generation: you bring in two face images with their masks (usually from two separate generated images, cut out with a background-removal or segmentation node), AutoFit Double lays them on one canvas with left/right placement, and then you sample around the composition. It also decides the whole prompt story for you: it detects the gender of each face internally and exports a mode_code that tells a Prompt Selector Double exactly which of its 16 template slots to draw from - two women, mixed couple, two men, times portrait/half-body/full-body/custom. That's the genuinely clever part of this pack: the geometry node and the text node share one numeric language.
How it works
Each side goes through the same pipeline as the single node: face detection (insightface default, with opencv, mediapipe, dlib, auto, none as alternatives), head-ratio and eye-line calculation, then a resize and paste onto the shared canvas. mode sets the canvas and framing - the built-in sizes are portrait 1024×720, half_body 1024×1536, full_body 1280×1600, custom via custom_width/custom_height. The per-side controls (move_L_x/move_L_y, face_size_L, angle_L, and the _R twins) let you nudge each person independently - which you will, because side-by-side faces usually need a nudge to actually look like they're sharing a frame. background picks white or gray for the canvas.
Inputs and outputs that matter
The four required image/mask inputs are image_L/mask_L and image_R/mask_R - left and right subjects. Then mode (portrait/half_body/full_body/custom) and detection_method. The three controls most beginners actually touch are move_L_x/move_R_x (get the spacing right), face_size_L/face_size_R (make sure the two heads are proportionate), and angle_L/angle_R (fix a tilted subject).
The outputs are where the value hides:
image- the composed two-person canvas, ready for the sampler.mask_L,mask_R,mask_combined- the per-person alphas and the combined one, all usable for masked inpainting.gender_L,gender_R(INT) andmode_code(INT) - the metadata that drives the prompt selector.
Wire mode_code into a Prompt Selector Double's mode_code input and the workflow picks the right template with zero input from you.
Installing it
Same as every node in this pack - one repo, one install. ComfyUI Manager → search ComfyUI_FaceAlignPaste, or:
cd ComfyUI/custom_nodes
git clone https://github.com/CHAOSEA/ComfyUI_FaceAlignPaste
Then restart. Dependencies are insightface, dlib, mediapipe, and opencv-python; insightface's buffalo_l model auto-downloads to ComfyUI/models/insightface/models on first use (shared with IP-Adapter plus if you already run that), and the dlib landmark model is bundled in the repo. Two install notes: dlib builds from source so Windows users need CMake and MSVC build tools, and insightface's weights carry a non-commercial license - fine for personal art, a problem if you're shipping a product.
Gotchas
- Left/right is fixed by input order.
image_Lalways lands on the left side of the canvas. Swap the inputs to swap the people, and remember the gender codes follow the same order -mode_codeassumes L then R, and getting it backwards gives the Prompt Selector the wrong couple template. - Same canvas-size caveats as the single node. First run downloads models,
nonedetection leans entirely on your masks, and the output is a composed flat canvas you still need to generate on top of. - Expect to nudge. Auto placement is decent, not miraculous - the per-side move controls exist because two faces almost never need zero adjustment.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| image_L | IMAGE | — | |
| mask_L | MASK | — | |
| image_R | IMAGE | — | |
| mask_R | MASK | — | |
| mode | COMBO | portrait | 4 options: portrait, half_body, full_body, custom |
| background | COMBO | white | 2 options: white, gray |
| move_L_x | FLOAT | 0-100–100 | — |
| move_L_y | FLOAT | 0-100–100 | — |
| move_R_x | FLOAT | 0-100–100 | — |
| move_R_y | FLOAT | 0-100–100 | — |
| face_size_L | FLOAT | 1.000.5–2 | — |
| face_size_R | FLOAT | 1.000.5–2 | — |
| angle_L | FLOAT | 0.0-180–180 | — |
| angle_R | FLOAT | 0.0-180–180 | — |
| detection_method | COMBO | insightface | 6 options: insightface, auto, opencv, mediapipe, dlib, none |
| custom_widthopt | INT | 1024256–4096 | — |
| custom_heightopt | INT | 1024256–4096 | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask_L | MASK | — |
| mask_R | MASK | — |
| mask_combined | MASK | — |
| gender_L | INT | — |
| gender_R | INT | — |
| mode_code | INT | — |