👤 S42 CutFlow Subject Isolate
Turning one masked video into subject plate, background plate, and a clean matte
- video
- subject_mask
- subject_plate
- background_plate
- refined_mask
- info
Here's the workflow this node exists for: you have footage of a subject, you cut the subject out of the background, and you want to regenerate the background while keeping the person. That's the "replace everything except the subject" trick that LTX 2.3 makes possible - but only if you give the model clean input. S42CF_SubjectIsolate takes a video plus a subject mask and splits it into three useful things: a subject_plate (the person composited on a flat color, ideal as an LTX guide frame), a background_plate (everything except the person), and a refined_mask (a cleaned-up matte). It's one of the LTX Bridge nodes in GeekyGhost's S42 CutFlow suite, and it's the glue between the pack's Background Remover and your LTX regeneration.
Inputs you'll actually touch
- video (IMAGE) - your source footage.
- subject_mask (MASK) - the matte from a background remover. White = subject, black = background. The tooltip is explicit about this polarity, and it matters - get it inverted and your "subject" is the background.
- output_mode - the important choice.
subject_on_blackis the default and the standard format for LTX guide frames: the subject on solid black gives the model a clean, unambiguous reference.subject_on_whiteis the same idea on white.subject_rgbaoutputs a true RGBA plate with an alpha channel, which is what you want for compositing outside the LTX context.background_onlygives you everything except the subject.background_inpaint_simpleis the dark-horse useful one: it fills the subject-shaped hole in the background using OpenCV's inpainting (edge extension), so you get a usable background plate without running a full inpainting diffusion pass. - expand_mask (int, default 3) - grows the mask by N pixels before extraction, which catches hair fringes and soft edges you'd otherwise leave behind. Too high and you start swallowing background.
- feather (float, default 2) - blurs the mask edge for smooth compositing, so the cut doesn't look scissored.
How it works
The mechanism is honest and visible: it dilates the mask (expand_mask), Gaussian-blurs it (feather), then just multiplies the video by the mask for the subject plate and by the inverted mask for the background plate. That's it - no model, no AI, milliseconds. The only piece that does any real image processing is background_inpaint_simple, which runs OpenCV's TELEA inpainting per frame to extend edge pixels into the subject region.
Outputs: subject_plate, background_plate, refined_mask, and an info string that reports frames, expansion, feather, and the mask's actual value range (a handy sanity check - if the range tops out well below 1.0, your source mask was weak).
Installing it
Same pack, same one-time install:
cd ComfyUI/custom_nodes/
git clone https://github.com/GeekyGhost/S42-CutFlow.git
pip install -r S42-CutFlow/requirements.txt # or ComfyUI Manager, search "S42 CutFlow"
Restart, find it under S42 CutFlow/LTX Bridge. The inpainting path needs OpenCV - which the requirements file already installs - so there's nothing else to grab.
Gotchas
Three things bite people. First, the mask polarity: if your plates come out inverted-looking, your source mask was flipped - invert it upstream. Second, background_inpaint_simple is edge extension, not true inpainting; it makes a reference plate, and complex backgrounds will smear. If you need a clean plate for final compositing, generate one or inpaint properly. Third, resolution mismatch: the node resizes the mask to match your video if they disagree, but a low-res mask resized up will have mushy edges - better to keep your mask at video resolution. And feed the subject plate to LTX guide conditioning rather than the raw video, or the model gets confused by the original background it's supposed to replace.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| video | IMAGE | Source video with subject to isolate. | |
| subject_mask | MASK | Subject mask from Background Remover. White = subject, Black = background. | |
| output_mode | COMBO | subject_on_black | 'subject_on_black' = subject composited on black bg (for LTX guide). 'subject_on_white' = subject on white bg. 'subject_rgba' = RGBA with alpha channel. 'background_only' = everything except the subject. 'background_inpaint_simple' = bg with subject area filled by edge extension. |
| expand_mask | INT | 30–20 | Expand the subject mask by N pixels for cleaner edges. |
| feather | FLOAT | 2.00–10 | Feather/blur the mask edges for smooth compositing. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| subject_plate | IMAGE | — |
| background_plate | IMAGE | — |
| refined_mask | MASK | — |
| info | STRING | — |