Nodes/BrainDead Nodes/BD Face Mosaic Compose
ComfyUI Node

BD Face Mosaic Compose

Stitch head views side-by-side without an unwrap

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD Face Mosaic Compose
  • images
  • landmarks_batch
  • rear_mask
  • strip_image
  • coverage_mask
  • inpaint_mask
  • status
front_index-1
left_index-1
right_index-1
rear_index-1
strip_width4096
strip_height1024
front_center_x0.50
left_center_x0.68
right_center_x0.32
eye_target_y0.40
face_height_ratio0.60
align_to_fronttrue
feather_radius30
rear_extent0.15
rear_split_x0.50
rear_flip_lrfalse
rear_confidence0.50
rear_blend_band0.06

Not every face-wrap job needs a mathematically correct unwrap. BD Face Mosaic Compose is the Photoshop-style alternative: it takes your 4 head-view photos, cuts them, aligns them, and pastes them side-by-side with feathered overlap into a strip. Each face stays geometrically intact - a similarity transform (rotate + scale + translate) gets the eyes horizontal and the face sized to the strip, but there's no cylindrical unwrap and no TPS deformation. The pack's own framing says it best: when the result is good enough that Qwen finalize is only doing cleanup, this is the node you want; when you need a true cylindrical unwrap, use BD Face Strip Compose instead.

How it works

For each detected view (front/left/right), a similarity transform is computed from the landmarks so the eyes are horizontal, the face height matches face_height_ratio × strip_height, and the eye-center lands at its target X column (front_center_x, left_center_x, right_center_x). Each view gets a feathered face-oval alpha and they're composited by alpha-weighted average - overlaps blend smoothly across the feather band, no visible cut lines. align_to_front (on) anchors each side view to a shared landmark (the tragion) so everything lines up at the right scale.

The rear photo is handled separately: split at rear_split_x and slotted at the strip edges. If you wire rear_mask (a head silhouette from BD_SAM3MultiPrompt or similar), each rear half is perspective-warped so its silhouette fills the slot; without it, plain cv2.resize.

The inputs you'll actually touch: the images batch (front, left, right, rear), the landmarks_batch, the four per-slot index overrides (front_index etc., -1 = auto) for when the classifier misassigns, and the strip/placement geometry (strip_width, strip_height, eye_target_y, face_height_ratio, feather_radius, and the rear knobs).

Outputs: strip_image, coverage_mask, inpaint_mask (same contract as the strip composer - feed it into the Qwen-fill subgraph), and status.

Installing

ComfyUI Manager → search "BrainDead" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead
pip install -r requirements.txt

Restart. Requires OpenCV (cv2) and the MediaPipe landmarker bundle (auto-downloaded by BD Face Landmarks).

Where people get burned

The whole trick is alignment, so feed it photos where the subject's head is roughly the same size and pose across views - if the front is huge and the side is tiny, align_to_front can only do so much. And remember what this node is not: it won't fix perspective or wrap geometry around the head. If your side views don't overlap the front by a good third (left_center_x 0.68 / right_center_x 0.32 are the defaults that get that overlap), raise the feather and overlap before you blame Qwen.

Category🧠BrainDead/FaceWrap

Inputs (21)

NameTypeDefaultDescription
imagesIMAGESource photo batch — typically 4 images: front, left, right, rear.
landmarks_batchBD_LANDMARKS_BATCHFrom BD_FaceLandmarks. Provides per-view landmark positions for the similarity transform.
front_indexINT-1-1–63Image index for the FRONT slot. -1 = auto.
left_indexINT-1-1–63Image index for the LEFT slot (subject's left, lands at strip-right by convention). -1 = auto.
right_indexINT-1-1–63Image index for the RIGHT slot (subject's right, lands at strip-left). -1 = auto.
rear_indexINT-1-1–63Image index for the REAR slot. -1 = auto.
strip_widthINT4096512–16384
strip_heightINT1024256–4096
front_center_xFLOAT0.500–1Strip-X column for the FRONT view's eye-center (0.5 = strip center).
left_center_xFLOAT0.680–1Strip-X column for the LEFT view (subject's left face). 0.68 lets the left view's hull overlap the front by ~⅓ — that's the overlap region Qwen smooths and where shared landmarks meet.
right_center_xFLOAT0.320–1Strip-X column for the RIGHT view. 0.32 mirrors left_center_x — same overlap with front.
eye_target_yFLOAT0.400–1Strip-Y row where every view's eye-center lands. 0.4 = 40% from top. Lower → more headroom above; higher → more neck/chin below.
face_height_ratioFLOAT0.600.1–1Target face height (chin↔forehead distance) as a fraction of strip height. 0.60 makes the face large enough that adjacent views overlap meaningfully at their face hulls (which is where shared landmark alignment happens).
align_to_frontoptBOOLEANtrueWhen ON: each side view's transform is anchored to a shared landmark (subject's-left tragion for the LEFT view, subject's-right tragion for the RIGHT view) so it lands at the SAME strip-space position as the front view placed it. This is literal 'align by face points' stitching — the left side of the front photo and the inner edge of the left-profile photo meet at the same subject feature. When OFF: each view independently targets its configured center_x (looser fit but easier to position manually).
feather_radiusoptINT300–200Gaussian-blur radius for the per-view face-hull alpha. 30 = moderate feathered selection — soft enough that adjacent views crossfade smoothly in the overlap region, but each view's face is still visible as itself. Increase for more blending; decrease (e.g. 10) for visible seams.
rear_extentoptFLOAT0.150–0.3Fraction of strip width per rear half (each side).
rear_split_xoptFLOAT0.500–1Column in the rear photo to split for the two halves.
rear_flip_lroptBOOLEANfalseSwap which rear half goes to which strip edge.
rear_maskoptMASKHead silhouette for rear photo (e.g. from BD_SAM3MultiPrompt('head')). When provided, each rear half is perspective-warped so its silhouette fills the slot from outer edge to back-midline. Without it, rear is plain cv2.resize-stretched.
rear_confidenceoptFLOAT0.500–1Weight applied to the rear contribution in the alpha-weighted composite.
rear_blend_bandoptFLOAT0.060–0.2Smooth-blend band width at the rear-slot boundary.

Outputs (4)

NameTypeDescription
strip_imageIMAGE
coverage_maskMASK
inpaint_maskMASK
statusSTRING