Mpi Load Image
The Load Image that admits when it loaded nothing
- image
- mask
- width
- height
- loaded
Core's Load Image has one annoying habit: when the file isn't where you said, you either get a stack trace or - worse - a run that proceeds against the wrong thing. Mpi Load Image is the same node with the bookkeeping exposed. It picks, drops or pastes an image like the built-in one, previews it in-graph, but it also hands you the width and height as numbers, lets you choose which channel becomes the mask, and gives you a loaded boolean so the graph can tell you the load failed instead of guessing.
That last bit is the reason to switch. If any part of your workflow branches on "did we actually get a picture" - batch runs, a queue fed by an app, an optional reference input - you currently fake it with extra nodes. Here it's an output socket.
How the load resolves
The node has two sources and a fixed order. string is tried first - a plain filename inside ComfyUI's input/ folder, subfolder included. If that's empty or doesn't load, the image picker is tried. Nothing loads only when both fail, which means the picker is on None, its default. That ordering exists so a host app can inject a filename into a saved workflow (picker left on None), and it doubles as a safety net: a stale string still falls back to whatever you picked.
Once it has a path, the load is identical to core's: EXIF transpose so phone photos aren't sideways, convert to RGB, divide by 255 into a float tensor. The mask depends on channel. On alpha (the default) it takes the alpha channel and inverts it, exactly like Load Image - opaque becomes 0, transparent becomes 1. On red/green/blue it takes that colour channel straight out of the RGB image, no inversion. If you feed it a JPEG with no alpha and leave channel on alpha, you get an all-zero mask, which is correct and not a bug.
Change detection is keyed to the resolved file's modified time and size, so overwriting input/ref.png re-loads it next run while a plain re-run reuses the cached tensor.
The inputs that matter
image - the picker, default None. block_if_empty - the one you'll actually think about. string - optional, tried first. channel - only worth touching if your mask should come from a colour channel.
Two failure strategies come out of that:
block_if_emptyON (default). A missing file blocks the whole downstream branch. Nothing runs, nothing half-runs, and you get no broken composite. This is what you want in a graph whose image is mandatory.block_if_emptyOFF. The node outputs a blank 1×1 image instead, plusloadedfalse, so you can reroute around the missing input with your own if/else.
loaded is never blocked, even in the blocked case, so it's the reliable signal for gating a fallback branch.
Outputs are image, mask, width, height, loaded. The width/height pair saves a detour through a resolution node when you just need the numbers for math or a filename.
Installing it
Manager is the easy path - it ships with ComfyUI now, and this pack is on the Comfy Registry under publisher mad-pony-interactive, so search ComfyUi-MpiNodes (or just "MpiNodes") under Custom Nodes Manager and hit install. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
Restart ComfyUI; no pip step is needed. The repo has no requirements.txt, and the imports it does use (torch, numpy, Pillow) are already in a working ComfyUI. Worth knowing what you're installing: this is a 100-plus node pack by the author of Cubric Vision, a free desktop front-end for ComfyUI, and it's AGPL-3.0 from version 1.2.7 onward. There's essentially no forum chatter about it yet, so you won't find a troubleshooting thread - the source is the documentation.
Where people get tripped up
Absolute paths outside ComfyUI's own folders are silently treated as missing. Paste C:\Users\you\Pictures\ref.png into string and the node reports nothing loaded, with no complaint about why. An absolute path is only accepted when it already lives under input/, output/ or temp/. That's deliberate - the /prompt endpoint takes workflows from anyone, so a free-text path widget that could read any file is a security hole - but it makes "my path is right, why is it empty" the number-one confusion here.
Subfolder files aren't in the drop-down. The picker lists only the loose files sitting directly in input/. Type the relative path instead - sub/ref.png - and it resolves fine.
It's a preview, not a save. The node inherits ComfyUI's Preview Image, which makes it an output node: it always runs, and its thumbnail goes to temp/, not output/. Grab the image you like before you close the tab, or hang a real save node off the wire.
A GIF loads its first frame. The extension is accepted, but this is a still-image loader; for a clip you want the video side of the pack.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMBO | Pick, drop or paste an image; it is uploaded into ComfyUI's input/ folder. Used when string is empty or does not load; None picks nothing. | |
| channel | COMBO | alpha | Which channel to output as the mask. 'alpha' inverts the alpha channel like LoadImage; red/green/blue take that color channel directly. |
| block_if_empty | BOOLEAN | true | ON: empty/missing path blocks downstream execution. OFF: outputs a blank 1x1 image so the graph continues. |
| stringopt | STRING | File name inside ComfyUI's input/ folder, with its subfolder if it has one (an absolute path must be inside input/, output/ or temp/). Tried first; if it is empty or does not load, the picker is tried. Nothing loads only when both fail (picker on None). |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| width | INT | — |
| height | INT | — |
| loaded | BOOLEAN | — |