BD Load Image
Load an image from a path string — and get its alpha as a mask for free
- image
- mask
- status
ComfyUI's built-in Load Image is fine when you're picking a file by hand. But the moment a path comes from somewhere else - a cache node, a filename template, a previous save - you need a loader that takes a path string as an input instead of a dropdown. BD_LoadImage is that node: feed it a file_path STRING, get an IMAGE back. It's the read half of the pack's caching story, right next to BD Save File and the BD Cache Image node.
And there's a genuinely useful bonus baked in: it splits out a mask output from the file's alpha channel (or its luminance, for grayscale files), so an RGBA PNG you saved earlier comes back as both the RGB image and its transparency as a proper MASK tensor. One node, two outputs you'd otherwise need extra steps to get.
How it works
The load logic is simple and visible in the behavior:
- RGBA → RGB image + alpha extracted as a
mask. - L (grayscale) → converted to RGB image + the grey values as a
mask. - Everything else → RGB image + a zero mask.
If the file doesn't exist or fails to load, it returns a harmless 64×64 black image and a zero mask plus a status line saying what went wrong - no workflow-killing exception. That fail-soft behavior is intentional for a loader that's often driven by generated paths; you see "File not found" in status instead of the whole run dying.
Inputs: file_path. Outputs: image, mask, status.
Where it fits
- Cache round-trips.
BD Cache Imagewrites cached PNGs; this node loads them back on later runs, skipping upstream generation. - Dynamic paths. Wire the output of
BD FilenameTemplateor a save node's path intofile_pathand the same loader works across many files. - Mask recovery. If your pipeline saved RGBA plates, this node recovers the alpha as a usable MASK in one step.
Install
Part of the BrainDead pack:
cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead
pip install -r requirements.txt
Or search "BrainDead" in ComfyUI Manager and restart. No extra dependencies - PIL and torch, both core.
Troubleshooting
- "File not found" but the file is there - the path is likely relative or has a typo. Use an absolute path (the cache nodes write absolute paths into output, so wiring their path output straight in works).
- The mask is all zeros - the file isn't RGBA or L-mode. JPEGs and opaque PNGs have no alpha to extract.
- Image comes back 64×64 and black - that's the fail-soft fallback; check the
statusstring for the real error.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| status | STRING | — |