Nodes/ComfyUI-ImagePathSelector/Image Path Selector
ComfyUI Node

Image Path Selector

Pick your input image from a thumbnail grid

By KursatAs·Created 4 months ago·Updated about a month ago· 2
Image Path Selector
    • image
    directory_path/tmp/ComfyUI/input
    refreshfalse
    selected_image

    The core Load Image node is fine until the moment it isn't - which is the moment you're staring at a folder of 400 slightly different renders and you can't tell from a filename which one you actually want. That's the exact pain this node exists for. Image Path Selector is a one-node pack that drops a scrollable thumbnail grid onto your canvas: point it at a folder, and you browse the actual images instead of guessing names.

    It's a pure utility in the plumbing layer of ComfyUI - no model, no API key, nothing to train. It lives in the image/selection category, and its entire job is answering one question: which image from this folder goes downstream?

    How it works

    The node does its real work in two halves. The backend (nodes/ImagePathSelectorNode.py) scans your directory, builds 256px thumbnails for every supported file, and hands them to the frontend as base64. The frontend JS (web/image_path_selector.js) paints those as a grid right inside the node, plus a larger preview on hover.

    Click a thumbnail and the JS writes the full path into the node's hidden selected_image widget, then calls app.queuePrompt(0, 1) - it re-queues the workflow itself. Because the node's IS_CHANGED hash includes selected_image, ComfyUI re-executes it, the backend loads that file as a tensor, and everything wired to the output fires. Your selection also persists across saves and reloads, via a small per-node storage dict, which is nicer than you'd expect from a node this niche.

    The trick that makes this safe in a graph: until you've picked something, select_image returns an ExecutionBlocker, so every node downstream just waits in the "blocked" state instead of erroring or generating with a placeholder. Nothing runs until you click.

    The inputs that matter

    Only three inputs exist, and two of them are set-and-forget:

    • directory_path (STRING) - the folder to scan. Defaults to ComfyUI's input directory. This is the one you'll actually touch.
    • refresh (BOOLEAN) - flip this to rescan. It only processes new/removed files, so it's cheap.
    • selected_image (STRING) - hidden, set automatically when you click a thumbnail. Leave it alone.

    Output: a single image (IMAGE) tensor, ready to wire into anything - an img2img-style pipeline, a VAE encode, a ControlNet preprocessor, whatever. The node is also marked an output node, so its grid shows up in the results area.

    Installing it

    This is the easy part. No requirements.txt - it only needs Pillow, torch, and numpy, all of which ComfyUI already has.

    cd ComfyUI/custom_nodes
    git clone https://github.com/KursatAs/ComfyUI-ImagePathSelector
    

    Then restart ComfyUI, or just search ComfyUI-ImagePathSelector in ComfyUI Manager and let it do the same thing.

    Optional extras: pip install rawpy for RAW camera formats (CR2, NEF, ARW, DNG, …) and pip install pillow-heif for HEIC/HEIF. JPEG/PNG/BMP/GIF/WebP work out of the box.

    Where people get burned

    A few sharp edges worth knowing before you point it at your photo archive:

    • It blocks until you click. First run of a workflow shows everything downstream as "blocked" and the node prints PAUSED - No selection made yet. That's the design, not a hang.
    • It drops a .ImagePathSelector.db SQLite cache inside the image folder. Hidden on Windows, plain as day on Linux/mac. That's what makes second loads near-instant, so deleting it just costs you a slow rebuild.
    • RAW is slow, and the author says don't load more than ~50–100 images per folder. Point it at your output folder with a few hundred PNGs and the first pass will crawl while it builds thumbnails.
    • Read-only folder? It silently skips caching and regenerates thumbnails in memory. Fine, just slower.
    • Corrupt cache? It detects it, deletes it, rebuilds. One less thing to babysit.
    • The 📁 Browse Folder button is Windows-only (it shells out to a PowerShell dialog); elsewhere you type the path.

    One genuinely thoughtful detail: PNGs with broken embedded text metadata - the tEXt/zTXt/iTXt chunks that ComfyUI's own workflows ride in on - get retried with those chunks stripped, so files that stall the stock loader usually still load here. At 0 impressions this is a brand-new node, so expect the odd bug, but for "let me actually look at what I'm about to feed the model," it's a genuinely nicer default.

    Categoryimage/selection

    Inputs (3)

    NameTypeDefaultDescription
    directory_pathSTRING/tmp/ComfyUI/input
    refreshBOOLEANfalse
    selected_imageSTRING

    Outputs (1)

    NameTypeDescription
    imageIMAGE