CPA EdgeColour
Killing the Halo Without Touching the Alpha
- images
- alpha
- clean_plate
- others
- comp
You got a perfect matte. Hair, individual strands, no chatter. You comp it over navy and there's a bright white rim around the hat.
That's not an alpha problem, and no amount of tuning the matte will fix it. Every semi-transparent edge pixel in the plate you shot still contains the background it was shot against - sky through the strands, grass along the shirt. The alpha says "40% covered"; the colour in that pixel is 40% person and 60% sky, and when you lay it over navy you get 60% of a sky you didn't want. Nuke solves this by extending the subject's own colour outward into the soft edge, and it's the standard fix in any comp. CPA EdgeColour is the pack's version, running as the last stage of the graph.
The key thing to hold onto: the alpha is never changed. All three modes produce an identical matte. What changes is the colour, and there's a new output next to the alpha - an rgba_ file, the clean premultiplied comp.
The two modes
mode is a combo of quick and perfect, surfaced on the main node as edge colour with quick as the default.
Quick is the classical one, and it's most of the value. It works in linear light: a Blur-Fusion pass (radius 90 then 6 at 1080p, scaled by frame size) builds the colour estimate, and an eroded-inside mask - alpha ≥ 0.98, shrunk 2px - is the source that colour gets pushed outward from, EdgeExtend style. Brightness is kept from the plate so strand and fabric texture survives, but clamped to the local mean ± 1.5σ of the subject's interior, which is what stops a white sky leaking in as brightness. It only rebuilds pixels near the real background (within ~24px, fading to the plate by ~40px), because LTX leaves fuzzy props semi-solid deep inside the subject and rebuilding those would smear them.
Cost: a couple of seconds a frame on the CPU, no VRAM, no extra model.
Perfect adds one thing: it unmixes against a Clean Plate. With clean_plate wired, it scales that up, checks it against the real plate, and computes F = (I - (1 - a) B) / a where the clean plate can be trusted - fading to the quick result where alpha is very low (the division blows up) or near 1 (LTX edges run a pixel wide, so even solid alpha can hold background, and only the extend fixes that). Confidence is judged from the ring just outside the matte, from whether the subject was actually removed inside it, and it's zeroed next to other people. Without the Clean Plate IC-LoRA installed, perfect silently runs quick and says so in the badge (perfect: Clean Plate LoRA not found, ran quick).
The other inputs
images is the plate, start offsets into it, alpha is the matte from CPA Final. info is a pass-through string - the Final node's info JSON, which comes back out in the UI payload with edge_colour and edge_note added, so the node badge can tell you which mode actually ran.
filename_prefix, format and first_frame control the rgba_ files written next to the alpha: rgba_01001.exr is scene-linear and premultiplied (the Nuke convention), rgba_01001.png is 16-bit sRGB with straight alpha (the PNG convention). comp switches the comp output, which is the premultiplied clean colour - only built if you wire it.
Optional others is used by perfect to zero confidence next to other people, where the true background behind the edge is a person the clean plate removed.
Where it sits
After CPA Final, as its own stage, on purpose: switching quick/perfect reuses the finished LTX passes rather than re-rendering the matte. Colour is temporally smoothed over ±2 frames with optical-flow compensation, so the reconstructed colour doesn't crawl while the matte holds still.
Install
Part of the pack. For perfect, additionally download ltx-2.5-22b-ic-lora-clean-plate-1.0.safetensors (~0.3 GB) from the gated LTX-2.5-22b-IC-LoRA-Clean-Plate repo into models/loras/, accept the terms first, press R in ComfyUI.
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
What it won't fix
Despill. If the subject genuinely reflects coloured light - green bounce from grass on skin - edge colour doesn't touch it, because that light is really in the subject. Despill in comp.
And the honest measurement caveat: quick gets background-in-edge down from 0.159 to 0.056 on the test shots, which is a large, visible improvement and still not zero. On a shot with a hard colour contrast in the background, check the comp over your actual final background rather than over grey - grey is forgiving.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| start | INT | 0 | — |
| alpha | MASK | — | |
| info | STRING | {} | — |
| mode | COMBO | 2 options: quick, perfect | |
| filename_prefix | STRING | comfy_pro_alpha/shot | — |
| format | COMBO | 2 options: png16, exr | |
| first_frame | INT | 1 | — |
| comp | BOOLEAN | true | — |
| clean_plateopt | IMAGE | — | |
| othersopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| comp | IMAGE | — |