Nodes/ComfyUI-RMAutomation/RM Face Composite
ComfyUI Node

RM Face Composite

Stitch the fixed-up faces back onto the original image

By Moser9815·Created 7 months ago·Updated 7 days ago· 0
RM Face Composite
  • original_image
  • processed_faces
  • face_data
  • image
blur_kernel_size30
blur_sigma30.0

RMFaceDetectCrop cuts the faces out and runs each through its own refinement pipeline. RMFaceComposite is the return trip: it takes the original image, the independently processed faces, and the face_data from the detect node, and pastes the good faces back where the bad ones were. If you've used the Impact Pack's FaceDetailer, this is the "composite the inpainted region back" step made explicit and controllable.

How it works

The node runs with INPUT_IS_LIST, which means it's built to collect the list of processed faces that came out of a per-face pipeline. It composites them one at a time onto the original: for each face, it rescales the processed crop back to the original crop dimensions, takes the rectangular detection mask that the detect node stashed in face_data, blurs it with a Gaussian (that's your blur_kernel_size and blur_sigma), and alpha-composites the face in. The blur is what keeps the fix from looking like a sticker - a hard-edged mask would scream "inpainted region."

The blurring even has a border falloff ramp that forces the mask to zero at the crop edges, which prevents seams at the boundary. If face_data says no faces were found, the node just passes the original through untouched, so a detection miss degrades to "no fix applied" instead of a crash.

Inputs and outputs that matter

  • original_image (IMAGE, required)
  • processed_faces (IMAGE, required) - the list output from your per-face pipeline (the thing after decode), one tensor per face.
  • face_data (RM_FACE_DATA, required) - from RMFaceDetectCrop or RMMultiDetectCrop.
  • blur_kernel_size (default 30) and blur_sigma (default 30) - bigger = softer blend but also more bleed of the fixed region into its surroundings.
  • Output: image (IMAGE) - the composited result.

How to install it

Part of the RMAutomation pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Moser9815/ComfyUI-RMAutomation

Requires opencv-python (imported at module level by the detect nodes - without it the whole pack won't load). Find it under RMAutomation/Face.

Common issues

The classic failure is a mismatch between the number of processed faces and the face_data entries - the node stops at whichever list runs out first, logs a warning, and composites the rest silently. If a face comes back wrong-shaped or the blend looks off, check that your per-face pipeline didn't crop or resize the face before this node; it expects each processed face to be the full face crop. And when the composite does nothing at all, that's the found: false path: check face_count from the detect node rather than staring at an unchanged image. Keep blur settings modest for faces - 30/30 is a good starting point, but on tight crops a huge kernel starts eating the good regions you just fixed.

CategoryRMAutomation/Face

Inputs (5)

NameTypeDefaultDescription
original_imageIMAGE
processed_facesIMAGE
face_dataRM_FACE_DATA
blur_kernel_sizeINT300–100
blur_sigmaFLOAT30.00.1–100

Outputs (1)

NameTypeDescription
imageIMAGE