Nodes/ComfyUI-SequentialImageLoader/Sequential Image Loader (folder)
ComfyUI Node

Sequential Image Loader (folder)

Walk a whole folder without touching Load Image

By shootthesound·Created 3 months ago·Updated about a month ago· 25
Sequential Image Loader (folder)
    • image
    • mask
    • filename
    • index
    • total
    • file_path
    directory
    include_subfoldersfalse
    index0
    filetypepng
    reversefalse

    The "right" way to run a workflow over a folder of images is miserable. You either swap the file inside Load Image by hand between every run, or you build a batch-loader contraption that fires everything at once and floods your VRAM. Sequential Image Loader (folder) is the option in the middle that most people don't know exists: it's a normal single-image loader that just remembers where it got to. Paste a directory, hit Queue, you get the next file. Queue again, the one after that. Loop, tweak settings, stop whenever - no rewiring, no index widget to bump by hand.

    It comes from shootthesound, who's an active ComfyUI author (they also maintain Realtime-Lora and Wan 2.2 I2V start-frame edit nodes), and the community reaction says it fills a real hole - "I was literally just looking for something like this" is basically the thread.

    How it works

    The trick is a hidden index widget. A small frontend hook on ComfyUI's app.queuePrompt increments that widget after each prompt is serialized and sent - so the run you just queued uses the current image, and the next Queue picks up the following one. Because the node's IS_CHANGED key includes index, ComfyUI re-runs it every Queue even though no visible input changed. When the index passes the last file it wraps back to the start. That's the whole mechanism, and it's why the README calls it "paced" - deliberately one image per Queue.

    The status line (Next: 3 / 240 · frame_003.png) doubles as a scrub bar: click to jump anywhere in the folder, click-drag to scrub. There's also Reset, Prev/Next (step without queuing), Hold last / Hold next to freeze on a frame while you tweak the graph, and Rescan to re-read the folder after you drop new files in. Files sort naturally, so frame2.png comes before frame10.png - the thing that trips up every naive sort.

    The inputs and outputs that matter

    The fields you actually set are the first few:

    • directory - paste an absolute path, or use the built-in Browse for folder picker, which browses the ComfyUI server's filesystem.
    • filetype - png (default), jpg, webp, tiff, or all for every supported type.
    • include_subfolders - walk subfolders recursively.
    • reverse - run the sequence last→first.

    The index field exists too, but it's mechanical - driven by the UI buttons, not something you hand-type. There's no model, no API, no key.

    Outputs: image (an RGB [1,H,W,3] tensor, EXIF-rotated), mask (from the alpha channel, inverted exactly like ComfyUI's Load Image; zeros if there's no alpha), plus filename, index, and total - handy for naming your Save Image output with the source file, or wiring into a prompt.

    Install

    It's a one-file pack with zero extra Python dependencies - pyproject.toml declares dependencies = [], and it only uses Pillow and torch, which ComfyUI already ships. Through Manager, search Sequential Image Loader. Or by hand:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/shootthesound/ComfyUI-SequentialImageLoader.git
    

    Restart ComfyUI and you're done.

    Where people get burned

    Mostly the things that are true of any stateful node. The position lives on the node and is saved with the workflow JSON, so headless runs through the API start from whatever index was saved last - there's no clean way to batch the whole folder from outside the UI. If you switch filetype mid-run, the index number sticks around and wraps via modulo; just hit Reset to start clean on the new set. And if directory is wrong or empty, the node raises a "No PNG files found" error rather than silently doing nothing - a real error, not a hang, but a path typo will still bite you. One last quirk: the remembered last-folder lives in the browser's localStorage, so it's per-browser, and only pre-fills new nodes.

    If your actual goal is "every image in one Queue," this isn't it - go find a batch loader. But for paced work - stepping frames through an upscale or I2V pipeline one at a time, reviewing each result - this is the one to reach for.

    Categoryimage

    Inputs (5)

    NameTypeDefaultDescription
    directorySTRINGFolder to scan for .png files.
    include_subfoldersBOOLEANfalse
    indexINT00–2147483647
    filetypeCOMBOpng8 options: png, jpg, jpeg, webp, bmp, gif, +2
    reverseBOOLEANfalse

    Outputs (6)

    NameTypeDescription
    imageIMAGE
    maskMASK
    filenameSTRING
    indexINT
    totalINT
    file_pathSTRING