Nodes/AntiMatter Nodes/Batch Loader from folder
ComfyUI Node

Batch Loader from folder

Stop dragging images in one at a time

By AntiMatterComfy·Created 3 months ago·Updated 28 days ago· 0
Batch Loader from folder
    • images
    • filename
    • format
    • width
    • height
    folder.uploading
    moderandom
    batch_size1
    freeze_count1
    seed0
    no_repeat_randomtrue
    recursivefalse
    reloadfalse
    resetfalse
    skip_exact_modedisabled
    skip_exact_width0
    skip_exact_height0
    move_processed_to_subfolderfalse
    processed_subfolder_name_processed
    resize_to_firsttrue
    show_previewtrue
    preview_max4

    ComfyUI's built-in image loader is a one-at-a-time affair, and the moment you want to run a folder of images through the same workflow - testing prompts, comparing models, processing a dataset - you're either scripting uploads or losing your mind. Batch Loader from folder points at a directory and hands you the whole thing as a proper ComfyUI IMAGE batch. It's from AntiMatter Nodes, and it's the kind of node you install for one specific day and then can't imagine being without.

    How it works

    You give it a folder and it scans for PNG, JPG/JPEG, WEBP, BMP, and TIFF/TIF files (nested folders if you flip recursive on). Relative paths resolve from ComfyUI's working directory, so .uploading works. Each image gets EXIF orientation fixed, gets flattened to RGB (RGBA becomes RGB), and the batch is assembled into one tensor.

    The selection logic is where it earns its keep:

    • mode: random - seeded and deterministic, so the same seed gives the same picks. Turn on no_repeat_random (it's on by default) and it draws without replacement, refilling the pool once every eligible file has been used - no accidental repeats during a long run.
    • mode: sequential - walks the folder in sorted order.
    • mode: batch_freeze - this one's the hidden gem. It picks one image and repeats it across the whole batch for freeze_count queue runs. That's your A/B testing tool: freeze one image, then vary the seed, prompt, model, LoRA, or sampler and compare apples to apples.

    There's more, all grounded in the source rather than marketing: skip_exact_mode filters out images by exact width/height (handy for skipping already-resized files), move_processed_to_subfolder shunts selected files into a _processed folder after loading so long runs don't reprocess, and resize_to_first (on by default) rescales later images to match the first - a mixed-size folder is not a valid ComfyUI batch otherwise. reload rescans the folder, reset clears the sequence/random state, and show_preview pops thumbnails in the UI.

    Inputs that actually matter

    For most people it's just four knobs: folder, mode, batch_size, and seed. freeze_count joins them the day you start doing comparison runs. The rest is situational.

    Outputs

    • images - the batch, straight into your VAE encode or sampler.
    • filename - basename without extension (or a comma-separated list for mixed batches). Wire it into output filenames or captions.
    • format - the source extension, useful for branching logic.
    • width / height - dimensions, for routing by size.

    Installing it

    Clone the pack once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AntiMatterComfy/antimatter-nodes.git
    

    Restart ComfyUI. It has no extra Python dependencies beyond what ComfyUI itself already ships (torch, numpy, Pillow), and no model files to download.

    Where people get burned

    The node deliberately raises errors instead of guessing, and the messages tell you exactly what to fix: no images in the folder, everything filtered out by skip rules, batch_size larger than the remaining pool while moving files, or a size mismatch when resize_to_first is off. If you turn resize_to_first off with mixed-size images, expect a hard stop - that's the one I'd keep on unless you have a reason. And remember it forces re-execution on every queue run (its IS_CHANGED returns infinity), so it won't quietly skip a step when your values look unchanged.

    CategoryAntiMatter/Image

    Inputs (17)

    NameTypeDefaultDescription
    folderSTRING.uploading
    modeCOMBOrandom3 options: random, sequential, batch_freeze
    batch_sizeINT11–64
    freeze_countINT11–999
    seedINT00–2147483647
    no_repeat_randomBOOLEANtrue
    recursiveBOOLEANfalse
    reloadBOOLEANfalse
    resetBOOLEANfalse
    skip_exact_modeCOMBOdisabled5 options: disabled, width or height, width and height, width only, height only
    skip_exact_widthINT00–65535
    skip_exact_heightINT00–65535
    move_processed_to_subfolderBOOLEANfalse
    processed_subfolder_nameSTRING_processed
    resize_to_firstBOOLEANtrue
    show_previewBOOLEANtrue
    preview_maxINT41–12

    Outputs (5)

    NameTypeDescription
    imagesIMAGE
    filenameSTRING
    formatSTRING
    widthINT
    heightINT