CorridorKey
The green-screen keyer that builds the matte and the fill at once
- image
- mask
- fg
- matte
- processed
- QC
Most background-removal stuff in ComfyUI is segmentation: it labels pixels foreground/background and hands you a cutout. This node is a different animal. It's a port of the open-source CorridorKey keying model (upstream: nikopueringer/CorridorKey) - the thing people in VFX have been talking about because it doesn't just pull a green-screen matte, it also reconstructs the foreground color with the spill cleaned out. Matte and fill in one pass. If you've ever spent an evening hand-rotoscoping hair or fighting green bounce on skin in a comp, you know why that's the part that matters.
The node is a thin, honest wrapper: it doesn't generate the mask for you. You bring a coarse alpha hint from RMBG, SAM, Florence, or a manual mask, and CorridorKey refines it into production-style passes. The community reaction when this landed (a March 2026 r/comfyui thread, where the author's own pack was shared as "already done") was basically finally - the standalone app was described as "slow but works," and the matte+fill quality as "crazy good." It's niche, it's heavy, but there's nothing else like it wired straight into a ComfyUI graph.
How it works
Under the hood it's the upstream four-channel model - GreenFormer plus a CNNRefinerModule - running at a fixed 2048×2048 inference resolution. It takes your RGB frame, stacks your coarse alpha hint on as a fourth channel, runs the network, then applies the upstream cleanup math: despill, connected-component despeckling, linear premultiplication, and a checkerboard QC composite. The 2048 size isn't a slider you're missing; it's what the model was trained on, so don't go hunting for a resolution input. On a batch, the node insists on one matching mask per frame rather than silently reusing a single mask - the mask has to describe the current frame, even if it's rough.
The inputs and outputs that matter
You really set three things:
- image + mask - the frame(s) and your coarse alpha hint. Keep the mask rough, soft, and slightly eroded. Tight, expanded mattes are the trap; upstream-style hints are closer to a loose paint.
- gamma_space (
sRGB/Linear) - how to interpret the incoming image before the fixed-resolution pass. PickLinearif your upstream chain already works in linear. - despill_strength - green removal after inference. 1.0 is default; crank it up and heavy spill can slide toward magenta/purple, so back it off and finish color in comp if that happens.
auto_despeckle / despeckle_size and refiner_strength are worth knowing but rarely need touching - despeckle defaults to 400 pixels, which is upstream's number and too big for small frames.
The four outputs are the whole point:
- matte - the linear alpha, ready to wire into your saver or a compositing chain.
- fg - raw straight foreground color (sRGB) for manual compositing; convert to linear yourself before you multiply.
- processed - linear RGB premultiplied by the matte, for quick preview or simple export.
- QC - the checkerboard sRGB composite, so you can eyeball the edge without importing anything.
None of these writes a file - you're still responsible for the save/export nodes on the other end.
Installing it
ComfyUI Manager may or may not list it yet (the README notes discovery depends on an external node registry), so the reliable path is manual:
cd ComfyUI/custom_nodes
git clone https://github.com/SeanBRVFX/ComfyUI-CorridorKey
cd ComfyUI-CorridorKey
python -m pip install -r requirements.txt
The one nonstandard dependency is timm - torch, torchvision, numpy, opencv, and Pillow you almost certainly already have. Then grab the checkpoint (the pack doesn't ship it):
wget https://huggingface.co/nikopueringer/CorridorKey_v1.0/resolve/main/CorridorKey_v1.0.pth \
-O ComfyUI/custom_nodes/ComfyUI-CorridorKey/models/CorridorKey.pth
Restart ComfyUI and it's under the CorridorKey category. Inference needs no network once the model is in place.
Gotchas worth knowing
The node's fixed 2048×2048 pass is not cheap - the bundled example took ~8 minutes on an RTX 4070 Ti Super, so treat long sequences as unattended batch work rather than interactive tweaking. On load it fires a background GitHub-API check for newer verified upstream commits; it never self-modifies code, and you can disable it with CORRIDORKEY_AUTO_CHECK_UPSTREAM=0 if you'd rather it not phone home. One honest caveat from the community thread: glass and overlapping semi-transparent objects can flicker frame to frame - CorridorKey is great, it isn't magic. And if you're billing a client, read the license first: upstream uses a CC BY-NC-SA-style non-commercial variant, and that carries over here.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input RGB image or image batch to refine. | |
| mask | MASK | Coarse Alpha Hint for the current frame. Keep it rough, soft, and slightly eroded. For batched images, provide one matching mask per frame. | |
| gamma_space | COMBO | Interpret the incoming image as sRGB or already-linear before the fixed 2048x2048 inference pass. | |
| despill_strength | FLOAT | 1.000–1 | Green despill amount after inference. 0 disables despill, 1 is the standard default. Higher values are stronger and can push heavy spill toward magenta or purple. |
| refiner_strength | FLOAT | 1.00–4 | Scales the learned refiner delta. 1.0 is the standard default behavior. |
| auto_despeckle | COMBO | Enable connected-component cleanup on the predicted alpha matte. | |
| despeckle_size | INT | 4000–4096 | Minimum island area in pixels to preserve when auto-despeckle is enabled. 400 is the standard default. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| fg | IMAGE | Raw straight foreground color. The model predicts this in sRGB space; convert to linear before manual compositing with the matte. |
| matte | MASK | Raw linear alpha matte. |
| processed | IMAGE | Linear foreground premultiplied by the linear matte for quick preview and simple downstream export. |
| QC | IMAGE | QC preview composite over a checkerboard in sRGB. |