Nodes/ComfyUI-AngelosKar/πŸ”„ AK Auto Image List Loader
ComfyUI Node

πŸ”„ AK Auto Image List Loader

One node that eats your whole folder

By AngelosKar-codeΒ·Created 3 days agoΒ·Updated about 19 hours agoΒ· 0
πŸ”„ AK Auto Image List Loader
    • images
    • filenames
    • total_images
    • run_counter
    • total_runs
    • folder_analysis
    β—„folder_pathC:\β–Ί
    β—„list_size10β–Ί
    β—„file_pattern*β–Ί
    β—„sortingnaturalβ–Ί
    β—„load_remainderonβ–Ί
    β—„remainder_positionendβ–Ί
    β—„file_name_without_extensiontrueβ–Ί

    Every ComfyUI user eventually wants the same boring thing: run this one workflow over every image in a folder, unattended, without the batch tensor eating their GPU. AK Auto Image List Loader is the compact answer - scan a folder, schedule the next chunk, load that chunk, repeat. It's the pack's πŸ“Š AK Image List Scheduler and πŸ“¦ AK Image List Loader fused into a single node, and for a simple pipeline it's the one I'd reach for first.

    How it works

    Two things are happening at once here, and it's worth separating them.

    The scheduling half. Every execution the node lists the folder, sorts it, and computes which slice belongs to this run - start_index and how many files. Progress lives in server memory, keyed to the node's id, and it bumps itself by one each run. When the slices run out it raises a deliberate error, which is exactly the stop signal ComfyUI's auto-queue in Run (On Change) mode wants: the loop keeps firing the prompt until some node throws, and that final throw ends the batch. Asking how to auto-queue a folder overnight and stop at the end is one of the oldest recurring questions on r/comfyui, and the accepted answer has always been "use a loader that errors when there are no more files" - that's the mechanic, just implemented for you with a progress readout attached. It also auto-resets when you change the folder, chunk size, pattern or sorting, so you don't have to babysit the counter.

    The loading half. Images come out as a list, not a batch. The node sets OUTPUT_IS_LIST on images and filenames, which tells ComfyUI to hand downstream nodes one image per call rather than stacking everything into a single 4D tensor. That's the VRAM-safe part of the pitch: ten images at 2048px in a list get processed one at a time, and each keeps its own resolution instead of forcing a common canvas. It also means the folder is re-scanned on every execution - this loader always re-runs, so don't expect the cache to save you any work.

    Inputs you'll actually set

    folder_path - there's a πŸ“‚ Browse Folder button right under it, and the default is C:\, so use it. list_size defaults to 10 (max 1000): this is your per-prompt memory knob, so drop it to 2 or 3 if you're working with big images on a small card.

    file_pattern is * by default and matched case-insensitively against the whole filename, so *_raw.png or shot*.jpg both work. sorting gives you natural (figures out that img2 precedes img10) or alphabetical (doesn't). load_remainder / remainder_position decide what happens to the tail when the folder size isn't a multiple of list_size - keep the tail at the end for ordered work, or switch load_remainder off to ignore it. file_name_without_extension strips the extension from the filenames output, which is what you want if you're feeding a Save Image filename_prefix.

    The folder scan is flat and the extension whitelist is .jpg .jpeg .png .webp .bmp .tiff .tif .gif. Subfolders are ignored and .avif/.jxl don't exist as far as this node is concerned.

    Outputs

    images (list) is the one that matters - wire it into VAE Encode, RMBG, an upscale chain, whatever your per-image work is. filenames (list) pairs with it, one name per image; building a filename prefix from it is the tidy way to keep outputs matched to inputs. total_images, run_counter and total_runs are progress numbers. folder_analysis spits out a plain-text report of the plan and the current chunk - read it straight out of the error message at the end of a batch, or send it to a text preview node.

    Two notes from the source: EXIF orientation is applied on load, so phone photos don't arrive sideways, and images are converted to RGB, which drops alpha - feed it transparent PNG cutouts and those pixels turn black. Remove backgrounds after loading, not before.

    Install

    Manager β†’ search ComfyUI-AngelosKar β†’ Install β†’ restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AngelosKar-code/ComfyUI-AngelosKar.git
    # restart ComfyUI
    

    Requires Python 3.10+ and torch, numpy, Pillow, aiohttp - all already in a healthy ComfyUI environment. Manager is the safer route generally: custom nodes run arbitrary Python at import, and Manager at least puts a known pack name in front of you.

    Where people get burned

    The end-of-batch ValueError looks like a crash and isn't - it's the loop's brake. Reset via the node's own πŸ”„ Reset Counter button, or the pack's AK Reset Counters if you want to zero everything at once. Counter values don't survive a ComfyUI restart, and node ids change if you delete and re-add the node, so state is fragile by design.

    Also worth knowing before you commit: one node means one pipeline. If you want the same folder driving two graphs, or you want to see the plan without the loader running, the separate AK Image List Scheduler + AK Image List Loader pair does that better, for the price of one extra wire.

    CategoryAngelosKar/Batch

    Inputs (7)

    NameTypeDefaultDescription
    folder_pathSTRINGC:\β€”
    list_sizeINT101–1000β€”
    file_patternSTRING*β€”
    sortingCOMBOnatural2 options: natural, alphabetical
    load_remainderCOMBOon2 options: on, off
    remainder_positionCOMBOend2 options: end, start
    file_name_without_extensionBOOLEANtrueβ€”

    Outputs (6)

    NameTypeDescription
    imagesIMAGEβ€”
    filenamesSTRINGβ€”
    total_imagesINTβ€”
    run_counterINTβ€”
    total_runsINTβ€”
    folder_analysisSTRINGβ€”