Nodes/ComfyUi-MpiNodes/Mpi Load Image From Path
ComfyUI Node

Mpi Load Image From Path

Load an image from anywhere on disk — with a preview and a mask

By MadPonyInteractive·Created 11 months ago·Updated 5 days ago· 3
Mpi Load Image From Path
    • image
    • mask
    • width
    • height
    string
    channelalpha
    block_if_emptytrue

    Core ComfyUI's LoadImage only reads from the input/ folder - drop an image in there, refresh, pick it from a dropdown. That's fine until the file you want is somewhere else on disk, or its name is decided by another part of your workflow at runtime. Mpi Load Image From Path is the escape hatch: type (or wire) a full string path to an image anywhere, and it loads with an in-graph preview, plus a mask and the width/height as bonuses.

    Outputs are where this node earns its keep. image is the loaded IMAGE tensor, width and height are the dimensions as INTs (wire them into a resize or a crop without re-measuring), and mask is derived from the file's alpha channel. The channel input (default alpha) controls that mask source: alpha inverts the alpha channel exactly like core LoadImage does, while red, green, or blue just take that color channel directly - useful when a file has a stored matte in a color channel. And because this node is marked as an output node with a preview, the image shows up in your graph like a LoadImage preview instead of vanishing into a black box.

    The second input worth understanding is block_if_empty, default ON. If the path is empty or the file doesn't exist, the node blocks downstream execution - that's an ExecutionBlocker, so nothing past it runs, and you don't need a separate blocker node in the chain. Flip it OFF and you get a blank 1×1 image and a zero-sized mask instead, letting the graph continue on a dummy frame. For an automation pipeline where "this image may or may not exist yet" is a normal state, that switch is the difference between a hard stop and a graceful fallback.

    Mechanically it's a straightforward PIL read, then a torch tensor in 0–1 - nothing exotic. The one behavior to keep straight is the mask inversion: alpha flips the alpha like LoadImage, so transparent areas come out as white in the mask (which is what most inpainting flows expect). If you pick red/green/blue there's no inversion, just the raw channel.

    Install is the pack's standard no-drama story: ComfyUI Manager → search "ComfyUi-MpiNodes" → install → restart, or

    cd ComfyUI/custom_nodes
    git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
    

    No dependencies, no models - pure Python from the Mad Pony Interactive pack (the engine under the Cubric Vision desktop app, which is exactly why the path handling is this permissive: a desktop app can stage a crop or a matte anywhere). If you've been juggling files into input/ just to satisfy LoadImage, this is the node that lets your graph read where it's told.

    CategoryMpiNodes/ImgOps

    Inputs (3)

    NameTypeDefaultDescription
    stringSTRINGImage file path. Named 'string' so it matches MpiString / MpiAnyChecker outputs.
    channelCOMBOalphaWhich channel to output as the mask. 'alpha' inverts the alpha channel like LoadImage; red/green/blue take that color channel directly.
    block_if_emptyBOOLEANtrueON: empty/missing path blocks downstream execution. OFF: outputs a blank 1x1 image so the graph continues.

    Outputs (4)

    NameTypeDescription
    imageIMAGE
    maskMASK
    widthINT
    heightINT