Load Image if Exist JNK
Load from a path and get a boolean you can branch on
- image
- exists
- index
Load Image if Exist does exactly what its name promises and then gives you something most image loaders don't: proof of whether it worked. It loads an image from a raw filesystem path and outputs the image plus an exists boolean and an index - so your workflow can branch on whether the file was actually there. That single boolean turns this from a convenience node into a conditional-logic primitive.
The classic pattern: a workflow that checks whether a previous run's output already exists, and only regenerates if it doesn't. Load the path, inspect exists, and use it with the pack's Switch nodes (or any boolean-aware logic) to skip expensive sampling when the work's already done. Same trick works for checking whether a source asset is present before processing it, so a queue doesn't fail silently on a missing file.
How it works
The node checks os.path.exists(image_path). If the file's there, it opens it with PIL, converts to a tensor, and optionally writes a temp preview. If it's not there, you don't get an error - you get a 64Γ64 black placeholder image, exists = false, and an index of 2. Loaded successfully, exists = true and the index is 1. That placeholder is deliberate: it keeps the graph flowing while making the failure detectable.
Inputs and outputs
image_path- the absolute filesystem path to the image (not a ComfyUI input-folder dropdown).show_preview- whether to render a preview in the UI (default true).
Outputs:
image- the loaded IMAGE, or the 64Γ64 black placeholder if missing.exists- BOOLEAN: true if the file loaded.index- INT: 1 if loaded, 2 if not.
Installing it
Pack install: search JNK in ComfyUI Manager, or
cd ComfyUI/custom_nodes/
git clone https://github.com/Aljnk/ComfyUI-JNK-Tiny-Nodes.git
PIL-based, no extra pip packages.
Where people get burned
The placeholder is the thing that will get you. Feed that 64Γ64 black image into a VAE or a sampler without checking exists and you'll get a tiny black result and have no idea why - the node didn't error, so it feels like it "worked." Always branch on exists before using image; that's what it's for. Second, the path is a raw filesystem path - it won't find images in ComfyUI's input folder just by name. And if show_preview is on, each load writes a temp preview file (that's normal, not a leak). Treat it as "load with a status light," and it'll save you a lot of head-scratching.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image_path | STRING | β | |
| show_preview | BOOLEAN | true | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |
| exists | BOOLEAN | β |
| index | INT | β |