Nodes/ComfyUI-Desert-Pixel-Nodes/DP Load Image Folder
ComfyUI Node

DP Load Image Folder

Batch-load a whole directory, with pagination and cycling built in

By DesertPixelAi·Created 2 years ago·Updated about a year ago· 25
DP Load Image Folder
    • images
    • masks
    • filename
    • dp_prompt
    • dp_negative_or_other
    • seed
    • frame_count
    directory
    image_load_cap1
    skip_first_images0
    Cycler_Mode
    index0
    resize_imagetrue
    width1024
    height1024

    ComfyUI's standard image loader wants you to pick one file from its input dropdown. This one takes a raw directory path instead - point it anywhere on disk - and loads from a whole folder, with pagination and per-run cycling controls layered on top. It's the node for anything driven off a batch of reference images: dataset prep, batch img2img, browsing a LoRA training set, that kind of job.

    How it works

    directory is a plain string path - not a dropdown, so it isn't limited to ComfyUI's input folder the way most loaders are. image_load_cap and skip_first_images work together as an offset/limit pager: skip the first N images, then load up to the cap from there. That's the tool for working through a large folder in manageable chunks rather than loading thousands of images at once.

    Cycler_Mode and index control which image (or images) get picked on repeated runs, using the same increment/decrement/randomize/fixed scheme the pack uses elsewhere - increment/decrement step through the folder one position at a time per queue, randomize picks at random, fixed always returns the same position. Combined with the offset/limit pager, you can page through a folder in batches and then cycle within each batch.

    resize_image plus width/height normalizes everything to a common size on the way out - useful since a real folder of images almost never comes in at one consistent resolution.

    Inputs and outputs

    Required:

    • directory - string path to the folder.
    • image_load_cap - 1 to 10000, default 1, how many images to load per run.
    • skip_first_images - 0 to 10000, default 0, offset before loading starts.
    • Cycler_Mode - increment, decrement, randomize, or fixed.
    • index - INT, default 0, effectively unbounded.
    • resize_image - boolean, default true.
    • width / height - 64 to 2048, default 1024 each.

    Outputs:

    • images - the loaded batch.
    • masks - corresponding masks (from alpha channels, presumably, for images that have them).
    • filename - source filename(s) as a string.
    • dp_prompt / dp_negative_or_other - extracted generation metadata, if present in the source files.
    • seed - an INT output, likely reflecting whatever seed drove the randomize selection, useful if you want to reproduce a specific random pick later.
    • frame_count - how many images were actually loaded this run.

    How to install it

    Search ComfyUI-Desert-Pixel-Nodes in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DesertPixelAi/ComfyUI-Desert-Pixel-Nodes
    

    Restart, find it under DP/image. No models or extra dependencies - just standard filesystem/image handling.

    Common issues & troubleshooting

    No images load / empty output. Since directory is a plain typed path rather than a dropdown, a typo or a relative path that doesn't resolve the way you expect is the most likely culprit - double-check it's an absolute path the ComfyUI process actually has read access to, especially if you're running ComfyUI inside a container or a different user context than the one you're typing paths from.

    Images load out of the order you expect. Filesystem directory listings aren't guaranteed to come back alphabetically or by date - if Cycler_Mode/index seem to be landing on unexpected files, the underlying folder order (rather than the cycling logic itself) may be the actual cause. Renaming files with a numeric prefix (001_, 002_, …) is the usual fix for imposing a predictable order.

    skip_first_images and image_load_cap interact confusingly. They're offset and limit respectively - skip_first_images=20, image_load_cap=10 loads images 21 through 30 of the folder, not "skip 20% and load 10% of what's left" or any other interpretation. Treat them exactly like a SQL OFFSET/LIMIT pair.

    dp_prompt/metadata outputs are empty. Only populated for source files that actually carry embedded generation metadata - a folder of plain photos or web-downloaded images will give you empty strings there, which is expected rather than a fault in the node.

    Too many images loaded, workflow runs slow or runs out of memory. image_load_cap has no low default protection beyond its own field default of 1 - if you crank it way up on a huge folder, you're loading that many images into memory in one run. Keep the cap sane relative to your available RAM/VRAM and page through with skip_first_images instead of loading everything at once.

    CategoryDP/image

    Inputs (8)

    NameTypeDefaultDescription
    directorySTRING
    image_load_capINT11–10000
    skip_first_imagesINT00–10000
    Cycler_ModeCOMBO4 options: increment, decrement, randomize, fixed
    indexINT00–18446744073709550000
    resize_imageBOOLEANtrue
    widthINT102464–2048
    heightINT102464–2048

    Outputs (7)

    NameTypeDescription
    imagesIMAGE
    masksMASK
    filenameSTRING
    dp_promptSTRING
    dp_negative_or_otherSTRING
    seedINT
    frame_countINT