Load Image (as Mask)
Import a mask without the picture
- MASK
Inpainting is "regenerate this region, leave everything else alone," and every inpainting workflow needs a mask - the map of where to regenerate. Load Image (as Mask) is the node that turns an image file into that mask tensor. It's a one-input addition on top of Load Image, and if you do any masked editing in ComfyUI, it's how you get your masks in.
What it is
Two inputs: image (the file picker, same as Load Image) and channel, a dropdown with four options - alpha, red, green, blue. It loads the file and extracts a single channel as a MASK output. Pick red and you get the red channel of the image as a grayscale mask; pick alpha and you get the alpha channel (where it exists). That's the entire mechanism: Load Image already computes an alpha-derived mask internally, and this node adds the choice of which channel to use. For PNGs with no alpha, the alpha option returns an all-black mask.
The mask convention you have to internalize
ComfyUI masks follow the inpainting convention: white (1.0) means "regenerate here," black (0.0) means "keep this." A mask where the subject is white and the background is black tells the sampler to replace the subject and preserve the background. Get it backwards and you'll inpaint the wrong half of the image - the most common mask mistake in the whole ecosystem.
Two traps hide in that convention:
- Alpha is inverted on the way in. Load Image computes its mask as
1 - alpha, because in PNGs alpha=1 is fully opaque. So a fully transparent area (alpha=0) becomes a white mask (regenerate). If your source file was built with transparency meaning "cut out," that's usually the behavior you want - but it surprises people coming from editors where the mask follows the RGB instead. - Black and white don't mean what Photoshop taught you. A mask file that looks "inverted" relative to a paint program is usually right for ComfyUI, and vice versa. When in doubt, feed it through a preview and check which region comes out white.
Where it plugs in
The MASK output feeds the classic inpainting chain: SetLatentNoiseMask on the latent, or InpaintModelConditioning for the newer edit-model approach, plus the compositing nodes (ImageCompositeMasked) that paste the inpainted region back. The community's current best practice is to composite after inpainting so the VAE encode/decode cycle never touches your unmasked pixels - the mask you load here is the thing that defines exactly which pixels survive untouched.
Getting it and where it goes wrong
It ships with ComfyUI core, a founding-era node in nodes.py - no install, no model files. It's also worth knowing that plain Load Image already outputs a mask (the alpha one, inverted, 1 - alpha). Load Image (as Mask) is for when you want a specific channel instead of the default alpha behavior - e.g. you've baked a mask into the red channel of a normal-looking image to smuggle it through formats that strip alpha. Where people burn: loading a JPG (no alpha, no problem - but also no alpha channel to select) and wondering why every channel looks similar, or feeding the output to a node expecting 0 = keep when they've painted their mask upside down. Check the convention once, verify with a preview, and it stops being a problem.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMBO | 1 options: example.png | |
| channel | COMBO | 4 options: alpha, red, green, blue |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |