ComfyUI Node

CPA Isolate

Painting Everyone Else Out So LTX Sees One Person

By rik-python·Created about a month ago·Updated 9 days ago· 50
CPA Isolate
  • plate
  • selection
  • others
  • isolated
◄grow6►
◄blur6.00►
◄start0►

The central hack of this whole pack lives in this node, and it's worth understanding even if you never touch it directly.

LTX-2.5 alpha-gen mattes every main subject it can see. You can't prompt it to matte one person, because alpha-gen runs on an empty prompt - that's a design property, not a bug. So the pack changes the input instead: it takes the plate, finds every other subject with SAM 3, and paints them out of a copy. LTX is then handed a plate with exactly one person on it, and mattes that person beautifully.

CPA Isolate is the painting-out.

How the paint actually works

Doing this naively - filling the other person's mask with a flat colour - doesn't work, and the pack's notes explain why: LTX reads a flat fill as a half-transparent object and mattes it. So the fill has to look like plausible background.

The mechanism, per frame:

  • The others mask is dilated by grow pixels (default 6) so the paint catches a little beyond the segmentation, and then intersected with 1 - selection so your subject is never painted.
  • The union of the paint region and the subject is turned into a hole mask.
  • That mask is inpainted with OpenCV's Telea inpainting at a quarter resolution, then scaled back up and blurred - blur (default 6) is the sigma.
  • The blurred reconstruction is composited under the paint mask, and your subject's own pixels go through untouched.

You can see the trade in that pipeline: the background behind the other person is a smooth, low-frequency approximation. That's fine. LTX doesn't need a photorealistic background, it needs something that isn't a person. And because it's built from the surrounding plate, colour and brightness match closely enough that the model doesn't try to make a subject out of it.

Do you care, as a user?

Yes, one step removed. Every matte of a crowded plate depends on this working. If you see LTX drawing a second person in your matte - or a ghost limb at the edge of frame - the isolated plate is where that came from, and the fix is usually on the selection side: a cut-click to remove something SAM 3 wrongly gave your subject, or an add-click on a part it missed.

Inputs and output

plate is the original full-precision images, not the uint8 plate node - and start (optional, default 0) is the frame offset into it. The node reads one frame at a time and works in float, because the pack's engineering notes found that a single 8-bit rounding change in the isolated plate made LTX produce a visibly different sample. That's a real, measured trap, and it's why this node takes a different input than its neighbours.

selection is your subject's mask over the processed range, others is everyone else's (the union of the excluded tracks). grow and blur are the two dials above; the native-resolution variant of this node defaults them higher because it's working at 2x scale.

Output is isolated: an IMAGE batch, uint8, which feeds the second LTX alpha-gen pass.

Install

Part of the pack, no extra dependency - the inpainting is OpenCV, which is already in requirements.txt as opencv-python-headless:

cd ComfyUI/custom_nodes
git clone https://github.com/rik-python/ComfyUI-Comfy-Pro-Alpha-Generator.git
pip install -r ComfyUI-Comfy-Pro-Alpha-Generator/requirements.txt

Restart ComfyUI. The node is /internal and hidden from the node menu; it exists inside the graph the generator builds.

CPA NativeIsolate is the same operation at the plate's own resolution, used by the 4K tile path - it scales the proxy masks up frame by frame and paints at native size. If you're reading an expanded graph on a 4K shot and wondering why there are two isolate nodes, that's why.

And the thing Isolate can not fix: someone crossing in front of your subject. There, painting out fails by construction - the other person is on top, so any paint either erases the overlap you needed or leaves them in. That's what overlap mode (v13) exists for, and it doesn't use this node at all; it keeps the real plate and steers LTX with attention masks instead.

CategoryComfy Compositing/internal

Inputs (6)

NameTypeDefaultDescription
plateIMAGE—
selectionMASK—
othersMASK—
growINT6—
blurFLOAT6.00—
startoptINT0—

Outputs (1)

NameTypeDescription
isolatedIMAGE—