load IMAGE+MASK from file (RGBA)
Load an image and its alpha channel as a ready-to-use mask
- image
- mask
- exists
Basic data handling: PathLoadImageRGBA ("load IMAGE+MASK from file (RGBA)") is the two-for-one loader: it reads an image from any path and hands you the RGB channels as an IMAGE and the alpha channel as a MASK, all in one node. PNGs with transparency become both a picture and a ready-to-use mask without a single extra step.
This is the node for anyone who does masked work - inpainting, compositing, background replacement - and happens to have their mask data stored as alpha. ComfyUI's inpainting and compositing nodes eat masks for breakfast, and this loader hands them straight over. A common pattern: designers save cutouts as transparent PNGs in whatever tool they use, and with this node those files become both the subject image and its selection mask, loaded from anywhere on disk (not just the input folder). No exporting mask files, no guessing at what's background.
How it works
The image half is the same as the pack's RGB loader: Pillow opens the file, EXIF orientation is applied, RGB is returned as a tensor. The mask half extracts the alpha channel and inverts it - 1.0 - alpha - so that opaque pixels become 0 (black/keep) and transparent pixels become 1 (white/discard), which is ComfyUI's mask convention where white marks what gets replaced or erased. If the image has no alpha channel at all, you get a blank all-black mask instead of an error.
Inputs and outputs
- path (STRING, default
"") - the image file. Absolute is safest. - image (IMAGE) - RGB tensor, alpha dropped.
- mask (MASK) - alpha channel as a mask, in ComfyUI's white-means-erase orientation.
- exists (BOOLEAN) -
Trueif the file loaded,Falseif missing/unreadable (in which case you get a 1×1 empty image and mask).
Installing it
Part of Basic data handling, no extra dependencies. ComfyUI Manager → search "Basic data handling" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart after. No models.
Gotchas
The inversion trips people up the first time. The mask output is inverted relative to the raw alpha because that's what mask inputs in ComfyUI expect - if your downstream node "looks backwards," check whether it wants the opposite orientation, and the pack's invert-style mask tools can flip it. Also remember a file with no alpha channel silently gives you a blank mask - fine for RGB sources, but if you expected transparency and got an all-black mask, that's why. If you only need one of the two outputs, the pack's dedicated PathLoadMaskFromAlpha is a leaner option. For cutout-and-composite work, though, this single node is the whole pipeline's front door.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| path | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| exists | BOOLEAN | — |