Nodes/ComfyUI-Image-Tools/SingleImagePathLoader
ComfyUI Node

SingleImagePathLoader

Load one image by its real file path — no input-folder roulette

By knuknX·Created 3 years ago·Updated 2 years ago· 3
SingleImagePathLoader
    • IMAGE
    path

    ComfyUI's built-in LoadImage is convenient, but it's tied to the ComfyUI/input folder and a dropdown of whatever happens to be sitting there. That means copying every file you want to touch into that one directory, and hunting through a flat list to find it. SingleImagePathLoader does the thing you'll wish LoadImage did the moment you've got files scattered across your disk: it takes one absolute path and loads that image, directly.

    It's one of eight small utilities in the ComfyUI-Image-Tools pack. Unflashy, and genuinely handy in exactly one situation: when the path isn't a constant you type once. Because the input is a plain string, another node (or an API driving your workflow) can compute the path for you - so you can point the graph at a file without ever copying it into the input dir. It's the plumbing that makes "read whatever my external script just wrote" workflows work.

    How it works

    Under the hood it's dead simple: cv2.imread(path) loads the file with the "unchanged" flag, the BGR order OpenCV uses is flipped to RGB, and the array becomes a standard ComfyUI IMAGE tensor. One image in, one IMAGE out. Nothing cached, nothing fancy, no model involved.

    The important word there is path. It's resolved on the machine actually running ComfyUI - the server, not your browser. If your ComfyUI lives on a cloud box or another PC and you type a path from the machine you're looking at, it will not find it.

    Inputs and outputs

    • path (STRING) - the only input. An absolute filesystem path to the image, e.g. /home/user/reference/girl.png or C:\renders\shot.png.
    • Output: IMAGE - one tensor, ready to wire into a VAE Encode, a control-net preprocessor, a KSampler's latent, anywhere you'd feed a normal image.

    There's no mask output like LoadImage has, and no file picker. That's the trade you're making.

    Install

    It ships in a pack, so install the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/knuknX/ComfyUI-Image-Tools
    

    Then restart ComfyUI. Easier still, use ComfyUI Manager and search for Image Tools. The pack's requirements.txt lists rembg, opencv-python, torchvision, torch, numpy, requests - everything except rembg is something a standard ComfyUI install already has, and this node only needs OpenCV anyway.

    Where people get burned

    • No existence check. cv2.imread returns None on a bad path, and the node then crashes with a traceback instead of a friendly "file not found." A typo, a trailing slash, or a relative path all do this.
    • Transparency survives. Images load with their alpha channel intact, so an RGBA PNG arrives as a 4-channel tensor. Plenty of downstream nodes expect 3-channel RGB and will silently drop or misbehave on the fourth channel. If that happens, route it through a node that flattens to RGB first.
    • The path leaks into your workflow JSON. That's inherent to the format, but worth remembering before you share a workflow PNG that points at your private directories.

    It won't sort, recurse, or give you a mask - for folders of images, that's what its sibling BatchImagePathLoader in the same pack is for. But for one file by its real path, this is the node.

    CategoryTools

    Inputs (1)

    NameTypeDefaultDescription
    pathSTRING

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE