Nodes/BrainDead Nodes/BD Head Cutout
ComfyUI Node

BD Head Cutout

Cut the head off — no neck, no angle selector, same result every time

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD Head Cutout
  • image
  • head_cutout
  • head_mask
  • status
head_promptshead face hair ear
exclude_promptsneck shirt clothing shoulder
neck_cuttrue
cutout_bgtransparent
smooth12
edge_refineoff
refine_radius8
refine_eps0.0001
refine_threshold0.50
vitmatte_modelsmall
mask_threshold0.50
jaw_modeneck_parser

Isolating just a head is a deceptively fiddly job. Cut too high and you lose the jaw; cut too low and you drag the neck and shoulders in; and every image seems to need different settings. BD_HeadCutout is the BrainDead pack's attempt to make it one node that does the same thing for every image - front-facing or profile, no angle selector. You feed it a person image and it returns the head on a transparent (or black/white) background plus a head mask you can apply to any downstream output.

It sits in the segmentation family alongside the SAM3 multi-prompt and parts nodes, and it's the natural answer to "strip the neck that Qwen added" or "get a consistent head plate for a flipbook/face socket pipeline."

How it works

Two segmentation passes, layered:

  1. SAM3, prompt-driven. It unions the head_prompts (default: head, face, hair, ear) as positives, then subtracts the exclude_prompts (default: neck, shirt, clothing, shoulder) as negatives. mask_threshold (0.5) controls the SAM3 text-segmentation confidence.
  2. A SegFormer neck pass. If neck_cut is on (default), an in-house face-parser pass removes the neck chin-safely - it bridges and then drops the disconnected neck via connected components, so it never slices a flat line through the chin. The chin stays part of the head.

Then smooth (default 12) rounds the lumpy boundary into an S-type jaw/chin curve - it's normalized at 1536px, so it auto-scales with resolution. Higher = smoother and rounder; 0 = raw silhouette.

The inputs that matter

  • jaw_mode - the interesting one. neck_parser (default) lets the SegFormer pass do its chin-safe removal, best when hair/clothing is complex. landmark_jawline cuts along the MediaPipe jawline instead - under-ear → jaw → chin - for a tight, consistent anatomical S-curve regardless of what's below. Both respect smooth.
  • edge_refine - optional edge snapping: off (raw), guided (fast), matting (soft hair), or vitmatte (best, but downloads a model). Hair is the case where you'll want matting or vitmatte; on a clean cutout, leave it off and save the runtime.
  • cutout_bg - transparent (RGBA), black, or white.

Outputs: head_cutout (the IMAGE), head_mask (the MASK, for wiring onto other images), and status.

Where it fits

The "why bother" is the flipbook/face-socket corner of the pack: a head cutout on a transparent plate is exactly what those texture pipelines want, and the pack's FaceWrap flow uses the mask to keep neck out of downstream compositing. If you only need this once, it's arguably overkill vs. a quick manual SAM3 mask - but if you're processing a sheet of character images that all need the same head treatment, "same way every time" is the whole selling point.

Install

Part of the BrainDead pack:

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

Or search "BrainDead" in ComfyUI Manager and restart. It leans on the pack's SAM3 infrastructure (which auto-downloads the official SAM3 checkpoint on first use), so the first run downloads weights.

Troubleshooting

  • Neck still creeping in - make sure neck_cut is on, and add neck-ish words to exclude_prompts (e.g. collar, turtleneck).
  • Chin cut flat - that's smooth too high or neck_parser misjudging; try landmark_jawline mode or drop smooth.
  • Frizzy hair looks chopped - turn on edge_refine with matting or vitmatte.
  • Head comes back with jaw too round - lower smooth toward 4–8.
Category🧠BrainDead/Segmentation

Inputs (13)

NameTypeDefaultDescription
imageIMAGE
head_promptsoptSTRINGhead face hair earSAM3 positives — one per line. Their union = the head.
exclude_promptsoptSTRINGneck shirt clothing shoulderSAM3 negatives — subtracted from the head (peels off neck / clothing / body).
neck_cutoptBOOLEANtrueRemove the neck via the SegFormer face parser (chin-safe: it never cuts a flat line into the chin — the chin stays as part of the head component). Off = keep whatever exclude_prompts left.
cutout_bgoptCOMBOtransparentBackground for the head_cutout image: transparent = RGBA; black/white = baked RGB.
smoothoptINT120–64Smooth the head boundary into an S-type jaw/chin curve (1536px-normalised, auto-scales with resolution). Rounds the lumpy SegFormer edge + the sharp neck-sever corners. 0 = raw silhouette; higher = smoother/rounder.
edge_refineoptCOMBOoffSnap the head edge to the image: guided (fast), matting (soft hair), vitmatte (best, downloads a model). off = the raw SAM3 + close silhouette.
refine_radiusoptINT81–64
refine_epsoptFLOAT0.00010.000001–0.1
refine_thresholdoptFLOAT0.500–1
vitmatte_modeloptCOMBOsmall2 options: small, base
mask_thresholdoptFLOAT0.500–1SAM3 text-segmentation threshold.
jaw_modeoptCOMBOneck_parserHow to cut the bottom of the head: neck_parser — SegFormer face-parser removes the real neck/clothing (chin-safe, default). Best when hair/clothing is complex. landmark_jawline — cut along the MediaPipe jawline (under-ear → jaw → chin) for a clean anatomical S-curve regardless of what's below. Best for a tight, consistent jaw cut. Both respect the smooth setting.

Outputs (3)

NameTypeDescription
head_cutoutIMAGE
head_maskMASK
statusSTRING