Nodes/DenRakEiw_Nodes/πŸ“ Load Image Sequence
ComfyUI Node

πŸ“ Load Image Sequence

Load images one at a time from a folder, without blowing up your RAM

By DenRakEiwΒ·Created about a year agoΒ·Updated a day agoΒ· 34
πŸ“ Load Image Sequence
    • image
    • filename
    • txt_filename
    • current_index
    • total_images
    β—„folder_pathβ–Ί
    β—„reset_sequencefalseβ–Ί
    β—„file_extensionsjpg,jpeg,png,bmp,tiff,webpβ–Ί
    β—„sort_methodalphabeticalβ–Ί
    β—„loop_sequencetrueβ–Ί
    β—„random_imagefalseβ–Ί
    β—„no_repeatstrueβ–Ί
    β—„seed0β–Ί

    ComfyUI's standard LoadImage needs a specific file, and LoadImageBatch tries to hold the whole folder in memory at once. When you're feeding a few hundred frames of an animation loop or a dataset through a pipeline, that's either tedious or a RAM disaster. LoadImageSequence is the middle path: it walks a folder, remembers where it left off, and hands you the next image every time the graph runs - one at a time. The README's pitch is "low memory usage vs batch loading," and that's the whole point of the node.

    How it works

    Give it a folder_path and it scans for image files (extensions default to jpg,jpeg,png,bmp,tiff,webp, overridable via file_extensions). Sort them - alphabetical, date_modified, date_created, or file_size - then track a per-folder position in memory, keyed by a hash of the folder path. Every execution loads the current image, then increments. Because state lives in the node instance, an empty run in the same workflow won't double-advance (there's a 100ms dedupe so re-executions inside one graph run reuse the same image). reset_sequence (BOOLEAN) forces the counter back to zero when you flip it. loop_sequence (default on) wraps back to the start; with it off the node parks on the last image.

    There's a genuinely useful random mode too: random_image picks randomly, and no_repeats (default on) ensures every image is used once before any repeats. seed makes the random draw reproducible (0 = true random). One quirk: the seed tooltip is in German ("Nur bei random_image: fester Seed = reproduzierbare Auswahl") - the author's documentation isn't perfectly translated, which tells you something about the support level to expect.

    Outputs - the useful ones

    • image (IMAGE) - the loaded frame.
    • filename (STRING) - the current file name.
    • txt_filename (STRING) - this one's the hidden gem: if a sidecar .txt caption file exists next to the image, this gives you its filename, so you can pull matching captions into a training or captioning workflow. That's the dataset sidecar convention in action.
    • current_index (INT) and total_images (INT) - progress for logic or display.

    Where it fits

    Frame-by-frame animation, feeding a dataset folder into a captioning or img2img pass, stepping through a reference set one at a time. Anywhere the alternative is "load all 500 images into VRAM." It's not a video node - it's the patient, memory-cheap way to walk a folder over repeated executions.

    Install and caveats

    Part of DenRakEiw_Nodes: ComfyUI Manager β†’ search "DenRakEiw Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DenRakEiw/DenRakEiw_Nodes
    cd DenRakEiw_Nodes && pip install -r requirements.txt
    

    then restart. No heavy deps - this one's plain Pillow/PIL.

    Caveats: state is in-memory, so restarting ComfyUI resets the position (the sequence starts over - flip reset_sequence if that's ever a problem, or just accept it). The folder path is a raw string, so it must exist and be readable; the node raises a clear "Folder path does not exist" error if not. And the pair-advance dedupe relies on a timing threshold, so pathological rapid re-executions can occasionally skip - if you see a frame jump, that's it.

    Categorydenrakeiw/image

    Inputs (8)

    NameTypeDefaultDescription
    folder_pathSTRINGβ€”
    reset_sequenceBOOLEANfalseβ€”
    file_extensionsoptSTRINGjpg,jpeg,png,bmp,tiff,webpβ€”
    sort_methodoptCOMBOalphabetical4 options: alphabetical, date_modified, date_created, file_size
    loop_sequenceoptBOOLEANtrueβ€”
    random_imageoptBOOLEANfalseInstead of going in order, load a random image from the folder
    no_repeatsoptBOOLEANtruerandom_image only: every image is used once before any repeats. Off means a free draw each time, so duplicates are possible
    seedoptINT00–18446744073709550000Nur bei random_image: fester Seed = reproduzierbare Auswahl. 0 = echter Zufall

    Outputs (5)

    NameTypeDescription
    imageIMAGEβ€”
    filenameSTRINGβ€”
    txt_filenameSTRINGβ€”
    current_indexINTβ€”
    total_imagesINTβ€”