Nodes/ComfyUI-BrainDead/BD Face Mosaic Compose
ComfyUI Node

BD Face Mosaic Compose

Photoshop-style mosaic stitch of 4 head-view photos: cut, align, paste side-by-side with feathered overlap. Per detected view (front/left/right): a similarity transform (rotate + scale + translate) is applied so eyes are horizontal, face_height matches face_height_ratio * strip_height, and the eye-center lands at the configured target X column in the strip. Each face stays geometrically intact — no cylindrical unwrap, no TPS deformation. A feathered face-oval alpha is built per view; views are composited by alpha-weighted average, so overlaps blend smoothly across the feather band. Rear photo: split at rear_split_x, slotted at the strip edges. If rear_mask (head silhouette from BD_SAM3MultiPrompt or similar) is provided, each rear half is perspective-warped so its silhouette fills the slot (same as BD_FaceStripCompose's rear path). Without it: cv2.resize. When the result is good enough that Qwen finalize is only doing cleanup, this is the node you want. When you need a geometrically correct cylindrical unwrap of the whole head, use BD_FaceStripCompose instead.

By BizaNator·Created 7 months ago·Updated 16 days ago· 14
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
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