TiledWan Image To Mask
Turn a colored region into a mask, without the fuss
- image
- mask
Every masking pipeline starts with getting a mask in the first place, and that's the whole job of TiledWan Image To Mask: pull one channel out of an image - red, green, blue, or alpha - and hand it back as a grayscale mask. It's a rework of ComfyUI's built-in ImageToMask from comfy_extras, with the two additions that make it actually usable in a video inpainting pipeline: normalization and clamping.
Why those matter. A raw channel rarely sits in a clean 0-to-1 range - a red-tinted region might only span 0.8 to 1.0, which is technically a mask but a uselessly low-contrast one. With normalize_output on (the default), the node stretches the channel to use the full 0–1 range, so subtle differences become real mask structure. clamp_output (also default on) keeps everything bounded in that range so nothing weird sneaks downstream. Both defaults are right; leave them alone unless you have a reason.
You'd reach for it when you want to convert a chroma-key region, an alpha cutout, or a colored selection into a mask to feed TiledWan Inpaint Crop Improved or the TiledWan Video VACE pipe. One quirk worth knowing: asking for the alpha channel on a plain 3-channel image doesn't error - it returns a fully opaque mask (all ones), since there's no alpha to read.
Inputs: image (IMAGE), channel (red/green/blue/alpha), clamp_output, normalize_output. Output: mask (MASK), where white means high channel values and black means low.
It's part of the comfyUI-TiledWan pack, so install via ComfyUI Manager (search "comfyUI-TiledWan") or cd ComfyUI/custom_nodes && git clone https://github.com/Baverne/comfyUI-TiledWan, then restart. No extra dependencies.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image to convert to mask. Can be any standard image format. | |
| channel | COMBO | Which color channel to extract as the mask. Alpha channel only available if image has transparency. | |
| clamp_output | BOOLEAN | true | Clamp output values to 0-1 range. Recommended to keep enabled for proper mask values. |
| normalize_output | BOOLEAN | true | Normalize the output to use full 0-1 range. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | Grayscale mask derived from the selected image channel. White areas indicate high channel values, black areas indicate low values. |