按路径加载图像 / Load Image By Path
Load images from anywhere, not just the input folder
- IMAGE
ComfyUI's native Load Image only wants to look inside its own input directory. That's fine until the image you need lives somewhere else - a downloads folder, a shared drive, a directory you've been batch-processing for weeks. Load Image By Path is the escape hatch: give it a full filesystem path and it loads that file, wherever it is, no copying into input first.
It's one of those nodes you don't need often, but the day you need it, nothing else will do. The obvious use is batch processing of scattered assets - a folder of reference photos, a stack of scanned pages, whatever - without staging them into ComfyUI. It also just makes certain workflows much easier to reason about, because the path you see in the node is the path of the file, no guesswork about which of four identically-named images you picked from a dropdown.
How it works
The mechanism is about as direct as it gets. The image_path input is a plain string, and the node hands it to PIL's Image.open(). It converts whatever it loads to RGB (so RGBA and other modes get flattened to three channels), scales to a 0–1 float tensor, and outputs a single IMAGE ready for the rest of your graph. Windows paths work as-is, backslashes and all, per the author's note - no escaping needed.
The inputs you'll actually set:
image_path- the only required input. A complete path to a PNG, JPG, JPEG, or anything else PIL can read.
The output is one IMAGE tensor. Note it does not produce the MASK output the native Load Image has - if you need the alpha channel as a mask, grab Load Image With Name from the same pack instead, or route the image through a dedicated alpha-extraction node.
Installing it
This is part of the RUI-Nodes pack ("Rui-Node🐶"), a bilingual Chinese/English collection. Install the pack once and this node shows up with all the others. Via ComfyUI Manager, search "RUI-Nodes" and install; or:
cd ComfyUI/custom_nodes
git clone https://github.com/rui40000/RUI-Nodes
cd RUI-Nodes
pip install -r requirements.txt
Then restart ComfyUI. The pack's base requirements are just torch, numpy, Pillow, and requests - nothing extra to hunt down for this node.
Where people get burned
The one genuine trap is baked into the design: if the file doesn't exist, the node doesn't error - it quietly hands you a 512×512 black image. That's a deliberate fallback for batch pipelines that shouldn't die on a missing file, but it means a typo in the path silently produces a black frame instead of a clear failure. If your output suddenly looks like a void, check the console for the 加载图像失败 warning line before you start debugging your sampler.
Also worth knowing: the default image_path value is the author's own Windows path from development, so if you connect this node for the first time and forget to set the path, you'll get that same black placeholder. Set the path first, then wire the output.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image_path | STRING | E:\ComfyUIModels\input\10\1.png | 图像文件的完整路径,可指向 ComfyUI 目录之外的任意位置。 适合批量处理散落在各处的素材,省去先拷进 input 目录。 Windows 路径直接粘贴即可,反斜杠无需转义。 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |