Nodes/ComfyUI-IC-Light-Native/IC Light Apply Mask Grey
ComfyUI Node

IC Light Apply Mask Grey

The Grey-Fill Node That Keeps IC-Light From Frying Your Cutouts

By huchenlei·Created 2 years ago·Updated about a year ago· 648
IC Light Apply Mask Grey
  • image
  • alpha
  • IMAGE

IC-Light's whole trick is that it re-lights a subject while leaving the subject itself alone. But it can only keep that promise if it can tell subject from background - and it reads that boundary from the color of the pixels behind the subject in the latent space. Leave that hidden area black and IC-Light treats it as a shadow; leave it white and it reads as a blown highlight. Feed it a normal remove-bg cutout - where the transparent region is black by default - and you get the classic failure: a background that comes out obscured (FC workflows) or darkened (FBC workflows). This node exists to prevent exactly that.

ICLightApplyMaskGrey is the smallest node in the pack and the one you're most likely to skip. Don't.

What it does

It composites your image over a flat mid-grey backdrop using the mask you already have. The math is one line:

result = image * alpha + (1 - alpha) * 0.5

Where alpha is 1 you keep the subject's pixels untouched. Where alpha is 0 - the transparent area - you get 0.5, i.e. grey 127. That's it. It is deliberately not a fancy premultiply or a feather; it is "paint the empty space grey," which is precisely the instruction IC-Light's author puts in the README: "make sure the fg image's masked/transparent area are grey before you pass it to the VAE."

The inputs that matter

Only two, and they're both obvious:

  • image (IMAGE) - your cutout, typically straight off a remove-bg node.
  • alpha (MASK) - the transparency mask for that same image. In the pack's own example workflows both come off one LoadImage node (its IMAGE and MASK outputs), so you rarely wire these separately.

Output: a single IMAGE you feed into a VAE encode. Nothing else.

Where it sits in the workflow

The canonical foreground pipeline in this pack looks like: cutout → ICLightApplyMaskGreyVAEEncodeArgMaxc_concat on ICLightAppply, alongside the KSampler chain. You'll find that exact arrangement in the bundled fg.json and fg_bg_combine.json examples. Grep any tutorial that shows a working IC-Light workflow and this node is usually sitting in the middle of it, unnamed and unthanked.

Install

The pack installs like any ComfyUI custom node - no pip dependencies, since this is a "native" implementation that only needs what ComfyUI already ships:

cd ComfyUI/custom_nodes
git clone https://github.com/huchenlei/ComfyUI-IC-Light-Native

Restart ComfyUI (or use Manager and search "IC-Light-Native"). The actual IC-Light models are a separate download from huchenlei/IC-Light-ldm - they go in ComfyUI/models/unet and load via UNETLoader. This node itself needs no models; it's pure tensor math.

Common issues

  • Skipping it. If your relight comes out with a murky or darkened background, the first thing to check is what color the empty area of your foreground actually is. If it's black, that's your problem, and this is the fix.
  • It's not a mask maker. If you don't have an alpha, this node won't create one. It takes the mask you already produced from a remove-bg tool (the pack's README recommends the remove-bg node from ComfyUI-Easy-Use) and only paints with it.
  • Grey matters more than you think. One known IC-Light trap from the wider community: a relight that reads as a flat "color overlay" is usually a sign your mask and your light direction are fighting. Grey-filling the empty area first takes one whole class of those failures off the table.

One-line verdict: it's a two-input, one-output utility, and in IC-Light workflows it's the difference between a cutout that behaves and one that quietly sabotages every relight you run.

Categorymask/compositing

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
alphaMASK

Outputs (1)

NameTypeDescription
IMAGEIMAGE