Nodes/Comfy Pro Alpha Generator/CPA DecodeStitchRGB
ComfyUI Node

CPA DecodeStitchRGB

The Only Decode in the Pack That Keeps the Colour

By rik-python·Created about a month ago·Updated 9 days ago· 50
CPA DecodeStitchRGB
  • vae
  • chunk_0
  • chunk_1
  • chunk_2
  • chunk_3
  • chunk_4
  • chunk_5
  • chunk_6
  • chunk_7
  • chunk_8
  • chunk_9
  • chunk_10
  • chunk_11
  • chunk_12
  • chunk_13
  • chunk_14
  • chunk_15
  • chunk_16
  • chunk_17
  • chunk_18
  • chunk_19
  • chunk_20
  • chunk_21
  • chunk_22
  • chunk_23
  • clean
◄plan—►

Here's a problem you only meet once you're doing real compositing in ComfyUI. Your alpha is right, but every soft edge pixel still contains the background the shot was filmed against - sky inside the strands, grass along the shirt. Comp that over navy and you get a white rim around a hat. The perfect mode of the pack's edge colour stage fixes it by rendering a Clean Plate: the plate with the people removed, background rebuilt. Then it subtracts that background out of the edge with F = (I - (1 - a) B) / a.

Which means you need the Clean Plate as colour. Every other decode in this pack deliberately throws colour away to save RAM. This one doesn't.

What it does differently

CPA DecodeStitchRGB takes the same plan and vae and the same up-to-24 optional chunk_0…chunk_23 LATENT inputs as its alpha sibling, and cross-fades the chunks with the same triangular weights. The differences are all about keeping three channels alive:

It doesn't collapse to grey. The output is clean, an IMAGE - RGB.

It holds uint8. The output tensor is allocated as uint8 from the start, and each frame is converted to 8-bit as soon as no later chunk can still contribute to it. Only the frames inside the current overlap are ever held in float. On a 1080p shot, a float32 RGBA frame list would be several gigabytes; this keeps the same information an sRGB compositor needs at a quarter of the footprint.

It frees as it goes. The float accumulator for a frame is popped the moment its last contributing chunk has been folded in, so the working set is one chunk's overlap, not the whole shot.

That's the whole node. It's a memory-shaped version of "decode and cross-fade, but RGB".

Where it sits, and how rarely

Only on the edge colour = perfect path. The chain is: LTX-2.5 with the Clean Plate IC-LoRA over the 1080p proxy, chunked like everything else → this node → CPA EdgeColour, which scales the clean plate up, checks it against the real plate, and unmixes the edge.

Which means if you're running edge colour = quick - the default - this node never executes. And if you select perfect without the Clean Plate LoRA installed, the pack doesn't fail: it runs quick instead and the badge tells you so. Read that badge before you conclude the feature did nothing.

Why this and not just a normal VAE decode

You could wire core's VAEDecodeTiled into a batch and hold the result. On a 49-frame 1080p preview, at float32, that's roughly 1.2 GB per chunk - fine if you have the RAM, and the pack's own measurements say the perfect mode costs about half again the render time of quick anyway. But the pack is explicit that the whole pipeline should fit on 12 GB VRAM / 16 GB RAM machines with models streaming off an NVMe, and a few cached float32 colour stacks is how that budget dies. Hence a decode node per memory profile rather than one general-purpose one.

Install

Ships with the pack:

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

For perfect specifically you also need ltx-2.5-22b-ic-lora-clean-plate-1.0.safetensors in models/loras/, from the gated LTX-2.5-22b-IC-LoRA-Clean-Plate repo - accept the terms on that page first, then press R in ComfyUI so the file shows in the model list.

Like everything in this pack's /internal category, the node is hidden from the node menu on purpose. It appears in the expanded graph and nowhere else.

When the output is wrong

The classic failure is a Clean Plate that didn't remove anyone - on a wide shot where the subjects fill the frame, LTX re-renders them instead of rebuilding the background. The pack handles this rather than pretending it doesn't: CPA EdgeColour compares the clean plate against the real plate both in the ring outside the matte and inside the solid subject, and falls back to quick wherever the clean plate can't be trusted. So "perfect looks exactly like quick on this shot" is usually a correct decision, not a bug - on close-ups the two are supposed to agree.

The other one is scale. The clean plate is rendered at proxy resolution and scaled up in the edge stage, because the edge only needs its colour and LTX invents the background's fine texture anyway. Don't go looking for a native-resolution clean plate pass; there isn't one.

CategoryComfy Compositing/internal

Inputs (26)

NameTypeDefaultDescription
planSTRING—
vaeVAE—
chunk_0optLATENT—
chunk_1optLATENT—
chunk_2optLATENT—
chunk_3optLATENT—
chunk_4optLATENT—
chunk_5optLATENT—
chunk_6optLATENT—
chunk_7optLATENT—
chunk_8optLATENT—
chunk_9optLATENT—
chunk_10optLATENT—
chunk_11optLATENT—
chunk_12optLATENT—
chunk_13optLATENT—
chunk_14optLATENT—
chunk_15optLATENT—
chunk_16optLATENT—
chunk_17optLATENT—
chunk_18optLATENT—
chunk_19optLATENT—
chunk_20optLATENT—
chunk_21optLATENT—
chunk_22optLATENT—
chunk_23optLATENT—

Outputs (1)

NameTypeDescription
cleanIMAGE—