Load Image Index From Dir
Grab image #N straight from any folder — no upload ritual
- image
- mask
- index
Core ComfyUI's LoadImage is a walled garden: it only reads from ComfyUI/input/, and every new reference image means an upload-and-copy detour before it appears in the dropdown. Load Image Index From Dir (from the Hangover Utils pack) skips that entirely. You type a folder path, it loads whatever image sits at index N, and hands you the pixels - no upload, no input-folder housekeeping. If you've got a real directory of images you want to feed into img2img, an inpaint mask, or a per-file pass, this is the node for it.
Before you get excited: this is a tiny, very new node inside a small hobbyist pack. The author is upfront that Hangover Utils is a learning work-in-progress, tested on Windows 10 only, and the README doesn't even list this node yet - the source added it in the pack's most recent commit. It's also completely unproven in the wild: search the usual corners and you'll find nobody talking about it. Treat it as a handy utility, not infrastructure.
How it works
Under the hood it's about twenty lines pasted on top of ComfyUI's own image-loading helpers, so the mechanics are reassuringly boring:
diris resolved as a raw path on disk - absolute or relative to wherever you launched ComfyUI. Nothing gets copied, nothing needs to live ininput/.- It accepts
.png,.jpg,.jpeg,.webp, and.avif(that last one needs thepillow-avif-pluginthat ships in the pack's requirements). - Like core LoadImage, it transposes EXIF orientation and, when the image has an alpha channel, outputs a mask where transparent areas are white (value 1). That's ComfyUI's standard "here's what to fill" convention, so the mask wires straight into inpaint/detailer pipelines. No alpha, no mask - you get an all-black one.
- Animated WebP/GIF get split into a batch of frames, one per image. Point it at stills.
- The author added a
fingerprintbased on the folder's file list (the modern-schema successor toIS_CHANGED), so add or remove a file and the node re-reads the folder on the next run without a restart.
One quirk worth knowing: the directory listing is not sorted. The index counts whatever order Python's os iteration happens to return, which on Windows is roughly stable but definitely not alphabetical. Don't assume index 3 is the third file alphabetically.
Inputs and outputs that matter
Only two inputs, both straightforward:
dir- a plain text field (no folder browser). Paste a full path, forward slashes work on Windows.image_index- which file to load, default0. Its control is set tofixed, so it won't auto-advance; bump it by hand or wire a value in to step through a folder.
Outputs are image, mask, and the index as an INT. That third one is more useful than it looks: connect it to a text/display node and you always know which file you're actually looking at when you've been paging through thirty variants.
Installing it
ComfyUI Manager: search "Hangover" and install ComfyUI_Hangover-Utils, then restart. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/Hangover3832/ComfyUI_Hangover-Utils
# restart ComfyUI
One honest caveat about scope: the pack's requirements.txt pulls in sympy, pyperclipimg, and pyperclip, but those exist for its math interpreter and clipboard-copy siblings. This loader itself only needs Pillow, numpy, and torch - which ComfyUI already has.
Where people get burned
- Wrong folder or empty folder → hard error. A nonexistent path or an index past the last file throws a bare
IndexErrorin the console; there's no friendly warning. Check the index and the path spelling first. - Stale output after editing a file in place. The fingerprint hashes filenames, not bytes. Overwrite
face.pngwith the same name and ComfyUI may keep serving the cached old version - rename the file (or nudge the index) to force a re-read. - It's new and versioned casually. The README says the pack "might change anytime," and category/schema naming has already shifted once. If a workflow breaks after an update, that's the pack being a moving target, not your mistake.
Honestly, for batch work you may be better served by the folder-to-batch loaders in WAS Node Suite or the Video Helper Suite, which slurp a whole directory in one go. This node's niche is narrower: you want exactly one specific file, by number, from a path you already know - and you want it without the upload dance.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| dir | STRING | — | |
| image_index | INT | 0 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| index | INT | — |