Nodes/Folder-Image-Picker/Folder Image Picker
ComfyUI Node

Folder Image Picker

The loader that stops reopening the wrong folder

By Martlet-Tech·Created about 15 hours ago·Updated about 14 hours ago· 0
Folder Image Picker
    • image
    ◄folder►
    ◄selected_image►

    Watch two Load Image nodes in one workflow and you'll see it: the second file dialog opens in the first one's directory, because ComfyUI remembers the last folder you picked globally, not per node. Two loaders, two libraries, and you spend the session re-navigating. Folder Image Picker is a small single-node pack that fixes that and little else - every node remembers its own folder, stored as a plain string in the workflow.

    Why you'd reach for it

    Reference-image work is where this bites: character passes, IPAdapter subject shots, ControlNet plates - several loaders, each pointed at a library you curated by hand. The built-in loader fights that arrangement; this one doesn't.

    Sneakier benefit: the selection is a string relative to the folder, so the node is fully drivable from the API. Anything running ComfyUI headlessly swaps the image by setting two strings. The grid is sugar on top. What it is not: a batch loader. One image per run.

    How it works

    The backend registers three HTTP routes on ComfyUI's own server, and a frontend extension builds the grid into the node body with a DOM widget, hiding the two string widgets underneath.

    • /list walks the folder with os.walk, keeps a fixed extension set (.png .jpg .jpeg .webp .bmp .gif .tif .tiff), sorts names, skips dot-directories.
    • /thumb renders a 320 px WebP into the pack's thumb_cache/ folder, keyed by an MD5 of path plus mtime - edit an image in place and its thumbnail invalidates itself. The grid fetches lazily as cells scroll in.
    • /pick shells out to PowerShell for the Windows folder dialog. No powershell.exe? Empty path, no exception.

    Loading is the path you'd want: PIL open → EXIF orientation applied → RGB → float32 0–1 → a one-image batch tensor. Mode-I (16-bit integer) files get rescaled first, which many loaders get wrong and turn into blown-out white. IS_CHANGED keys on path plus mtime, so overwriting a file and re-queueing gives you the new pixels, not the cached tensor.

    Path handling is confined too - requests resolve inside the configured folder, and ../ comes back HTTP 403. Nice to see in a pack this size, given custom nodes are unsandboxed by default.

    The inputs and the output

    Both inputs are STRINGs, and both are normally hidden behind the grid:

    • folder - absolute path to the directory. Stored in the workflow, which is how each node remembers its own location.
    • selected_image - the chosen file relative to folder, e.g. shirts/blue_linen.png. In recursive mode the subfolder is part of the key, keeping identically-named files distinguishable.

    The single output is image, an IMAGE batch of one. Wire it wherever Load Image's output would go - VAE Encode, an IPAdapter CLIP-vision input, a ControlNet preprocessor, ImageScale. Both inputs being plain strings, the node's state serializes into the workflow JSON: hand someone your file and it opens with your folders remembered, paths permitting.

    Installing it

    It's in the ComfyUI Manager registry - search Folder Image Picker and install. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Martlet-Tech/Folder-Image-Picker
    

    Portable Windows build: cd ComfyUI_windows_portable/ComfyUI/custom_nodes first.

    Then restart ComfyUI. The pyproject.toml declares zero dependencies - PIL, numpy, torch and aiohttp ship with ComfyUI already - and there are no model downloads. Restart properly rather than refreshing the tab; the HTTP routes register at startup.

    Where people get burned

    Nothing selected means a black image, not an error. With an empty folder or selected_image, the loader returns a 64×64 black tensor and prints one line to the console. "Why is my output black and 64 px" is almost always this. Read the console before you blame the sampler.

    The folder dialog is Windows-only. The 📁 Choose Folder button is PowerShell under the hood and returns an empty path anywhere else. Scanning and thumbnails are OS-agnostic, and the README says non-Windows users enter a path manually - but the shipped JS hides both string widgets behind the grid, so don't hunt for a text box on the node. Load a workflow that already has folder set, or edit it in the JSON.

    It isn't confined to ComfyUI/input/. That's the point - point it at E:\refs - but it means your workflows carry absolute paths from your machine. Move the library, rename a drive letter, hand the workflow to a friend, and every picker in it goes blank.

    A big recursive folder chugs the first time. Scans and thumbnail builds are on demand, so browsing tens of thousands of images with Subfolders enabled will stall the server while it resizes. Leave the toggle off unless you need it.

    Usual small-pack caveat: this code runs unsandboxed on import and adds HTTP routes to your server. __init__.py is about 200 lines - read it before installing, and note the thumb_cache/ folder it never prunes.

    Categoryimage

    Inputs (2)

    NameTypeDefaultDescription
    folderSTRING—
    selected_imageSTRING—

    Outputs (1)

    NameTypeDescription
    imageIMAGE—