Nodes/ComfyUI-AngelosKar/πŸ“Š AK Image List Scheduler
ComfyUI Node

πŸ“Š AK Image List Scheduler

Chunk a folder, let Run on Change do the babysitting

By AngelosKar-codeΒ·Created 3 days agoΒ·Updated about 19 hours agoΒ· 0
πŸ“Š AK Image List Scheduler
    • folder_path
    • sorting
    • file_pattern
    • start_index
    • list_size
    • total_images
    • run_counter
    • total_runs
    • folder_analysis
    β—„folder_pathC:\β–Ί
    β—„list_size10β–Ί
    β—„file_pattern*β–Ί
    β—„sortingnaturalβ–Ί
    β—„load_remainderonβ–Ί
    β—„remainder_positionendβ–Ί

    So you've got 400 images in a folder and you want the same img2img / upscale / background-removal pass over all of them. The folder itself is never a problem in ComfyUI - the problem is that the loaders hand you one giant batch tensor and you sit there watching VRAM. AK Image List Scheduler takes the other route: it doesn't load anything. It counts your folder, decides which slice of files belongs to this queue run, and lets ComfyUI run the workflow over and over until the folder is done.

    How it works

    Every time it executes, the node lists the folder, sorts the filenames, does the arithmetic full_runs = total // list_size plus a remainder, and returns the start_index and list_size for the current run. It keeps that progress in a class-level dict on the server, keyed by the node's unique_id, incrementing after each run.

    Two details make it actually pleasant to use. First, it re-worked out its "settings hash" on every execution - folder, list size, pattern, sorting, remainder options, and a cheap signature of the folder contents (count|first file|last file). Change the folder or the chunk size and the counter resets itself to run 1. You don't have to remember to reset anything. Second, when you've reached the end it raises a ValueError on purpose. That's not a bug: with ComfyUI's auto-queue set to Run (On Change) - the mode the queue button exposes - the loop keeps requeuing until a node throws, and that error is the brake. People have been assembling this by hand for years ("set the primitive to increment after generation, and auto queue… it will run through each image in the folder one at a time, until it hits the end"), usually by bolting together a folder loader that errors out when it runs dry. This node is that trick, packaged, with a progress readout.

    The node declares the folder and filesystem stuff plainly in its own source: flat folders only, no subfolder scanning, and a case-insensitive fnmatch pattern against the filename. Extensions it recognises: .jpg .jpeg .png .webp .bmp .tiff .tif .gif. That's it - an .avif or .jxl folder will legitimately report "No images found".

    The inputs that matter

    folder_path and list_size are the two you'll actually touch. list_size defaults to 10 and caps at 1000; it's your memory knob, since a chunk of 10 means ten images' worth of pixels are alive during that prompt. There's a πŸ“‚ Browse Folder button on the node so you're not hand-typing backslashes.

    sorting is natural or alphabetical. Natural splits filenames on digit runs, so img2.png comes before img10.png; alphabetical is a plain lowercase string sort and will happily give you img10 first. If frame order matters to you, natural is almost always what you mean.

    load_remainder (on/off) and remainder_position (end/start) handle the folder that isn't a clean multiple of list_size. With 47 images and list_size 10 you get four full runs and a 7-image tail; on + end schedules that tail last, on + start puts the short run first, off skips those 7 images entirely.

    The outputs

    Nine of them, and only the first five belong on a wire to the loader: folder_path, sorting, file_pattern, start_index, list_size. total_images, run_counter and total_runs are for whatever progress display you like. folder_analysis is the nice one - a multi-line text report of the split, the current run number, and a preview of the next filenames, which is what you see printed inside the final error too.

    Install

    ComfyUI Manager, search ComfyUI-AngelosKar, install, restart. Or:

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

    The dependency list is torch, numpy, Pillow, aiohttp - all four are already present in any working ComfyUI install, so this pack effectively adds nothing to your environment. Python 3.10+. It's an MIT-licensed single-author pack.

    Where people get burned

    The red error at the end is the feature. "βœ… All N image list runs completed" arrives as a raised exception in your console and a red node. That's the loop stopping. Click πŸ”„ Reset Counter on the node (or drop the pack's AK Reset Counters node) to zero it and go again.

    Counter state is server memory. Restart ComfyUI and every counter is back to 0. That's usually what you want, but if you closed the app mid-batch and wondered why you're redoing the first ten images - that's why.

    Ignore the folder logic at your peril. Point it at a folder of subfolders and it finds nothing. Change the number of files in the folder mid-run and the content signature shifts, so it resets and starts over.

    Buttons missing, node looking plain? The pack ships a js/ frontend directory; if you installed while the browser was open, hard-refresh (Ctrl-F5). Custom-node panels that come from a web extension are the usual victim of a cached app.js.

    CategoryAngelosKar/Batch

    Inputs (6)

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

    Outputs (9)

    NameTypeDescription
    folder_pathSTRINGβ€”
    sortingSTRINGβ€”
    file_patternSTRINGβ€”
    start_indexINTβ€”
    list_sizeINTβ€”
    total_imagesINTβ€”
    run_counterINTβ€”
    total_runsINTβ€”
    folder_analysisSTRINGβ€”