Nodes/ComfyUI-UtilsCollection/Staged Face Background Composite
ComfyUI Node

Staged Face Background Composite

Background Composite That Lets You Drag the Faces Around

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Staged Face Background Composite
  • background
  • foreground_images
  • background_options
  • face_options
  • image
  • mask
  • Boxes
  • Layer Masks
execution_moderun_staged
placement_data{"version":3,"workspace_padding":0.5,"layers":{}}
background_removal_model_namebirefnet

The good news: it's a layered compositor that cuts out your foregrounds, detects every face in them, and turns each face into its own moveable layer. The bad news: that sentence is the whole reason you need this article, because the node does a lot and only does it through a frontend placement editor. But it's genuinely the most fun node in the pack - you can assemble a scene where you cut out a person, then grab their face as a separate element and nudge it around while the rest of the cutout stays put.

What it does

You feed it a background and any number of autogrowing foreground_* images. It runs background removal on each foreground (BiRefNet by default, lucida as the alternative - both auto-download into ComfyUI/models/background_removal on first use), detects faces with ComfyUI core's MediaPipe FaceLandmarkerModel (mediapipe_face_fp32.safetensors, pulled from Comfy-Org/mediapipe into models/detection), and adds each face as an independently placeable layer on top of its own cutout. No Ultralytics, no AGPL runtime - MediaPipe's Apache 2.0, which is a real licensing win if you're compositing anything you intend to ship.

The output sockets are image, mask, Boxes (bounding boxes of the detected regions), and Layer Masks (one mask per layer) - so you can also use this purely as a detection/compositing engine and do your own thing downstream.

The three execution modes (this is where people get confused)

  • run_staging - cut everything out and populate the placement editor with the retained cutouts. This is the "set up the scene" pass.
  • run_staged - composite the retained cutouts with your placement edits, without re-running the removal or face models. This is the fast-iteration pass and the default. If nothing has changed, the cached result is reused.
  • full_run - restage and composite in one queue. Use this after you change the options or swap a foreground and want everything rebuilt.

placement_data is the JSON blob ({"version":3,"workspace_padding":0.5,"layers":{}}) that the frontend placement editor writes. You'll rarely hand-edit it - drag in the UI, let the node serialize. The optional background_options and face_options sockets take the config structs from the two companion nodes (UC_StagedLayeredBackgroundCompositeOptions and UC_StagedMediaPipeFaceOptions), which hold the cleanup, feathering, and blend dials. Leave them disconnected for defaults.

Installing it

It's part of ComfyUI-UtilsCollection by silveroxides:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart ComfyUI. Or install "ComfyUI-UtilsCollection" via Manager. Only opencv-python and typing-extensions come from the pack; the models are fetched by ComfyUI core on first run, so the first staging pass downloads a couple hundred MB and looks hung. It isn't - give it a minute.

The gotchas worth knowing

The retained cutouts are held in server memory (a small per-node cache, max ~8 entries). Restart ComfyUI and your staging is gone - you have to re-run staging before run_staged will composite anything sensible. Also, a stale run_staged will silently reuse old cutouts even after you change options; when a knob doesn't seem to do anything, force a full_run. And detection isn't identity - MediaPipe finds faces, it won't tell whose. For matching specific people across frames you'd still reach for an embedding model, but for "cut these out, let me place them," this is the one.

Categoryutils/image

Inputs (7)

NameTypeDefaultDescription
backgroundIMAGE
execution_modeCOMBOrun_stagedFrontend-managed staging request; ordinary composition validates and reuses retained cutouts automatically.
placement_dataSTRING{"version":3,"workspace_padding":0.5,"layers":{}}
background_removal_model_nameCOMBObirefnet2 options: birefnet, lucida
foreground_imagesCOMFY_AUTOGROW_V3
background_optionsoptUC_STAGED_LAYERED_BACKGROUND_OPTIONS
face_optionsoptUC_STAGED_MEDIAPIPE_FACE_OPTIONS

Outputs (4)

NameTypeDescription
imageIMAGE
maskMASK
BoxesBOUNDING_BOX
Layer MasksMASK