Nodes/ComfyUI_SimpleButcher/Simple Load Images from Dir
ComfyUI Node

Simple Load Images from Dir

Batch-load a folder of images with their metadata intact

By KLL535·Created 2 years ago·Updated 12 months ago· 13
Simple Load Images from Dir
    • image
    • mask
    • metadata_parameters (forge)
    • metadata_workflow
    • metadata_prompt
    • batch_counter
    • line_counter
    • lines
    name
    input_path
    start0
    nextincrement
    include_subdirfalse
    count0

    Batch-loading images from a folder isn't exotic - plenty of nodes do it. What's less common is doing it and keeping the embedded metadata alive: the PNG chunks holding the original prompt, seed, and settings, whether that image came out of Forge or ComfyUI itself. Simple Load Images from Dir is the image-side twin of this pack's text-file loader - same cycling logic, but pulling files from a directory instead of lines from a .txt, and surfacing every metadata field it finds along the way instead of discarding it.

    How it works

    Point input_path at a folder and it walks through the image files inside using the same enumeration modes as its text sibling: increment / decrement step through in order from start, fixed locks to one file, random picks freely, and random no repetitions shuffles through the whole folder once before repeating (note start gets ignored once you're in a random mode). Flip include_subdir on if you want it to also pull from nested folders instead of just the top level.

    For whatever image gets selected, it reads and returns all three metadata fields a PNG can realistically carry: a Forge-style parameters text block if present, the ComfyUI workflow JSON if the image was saved from ComfyUI, and the raw prompt JSON alongside it. Nothing gets modified or re-encoded - this is a read, not a conversion.

    The inputs and outputs that matter

    input_path and next are what you're actually configuring - where to look and how to walk it. name is cosmetic labeling for when you've got several of these in one graph, and include_subdir is the one flag worth remembering: it's off by default, so a folder-of-folders setup will silently only touch the top level until you turn it on.

    On output, image and mask are the standard pair you wire to anything expecting a loaded image. The three metadata strings - metadata_parameters (forge), metadata_workflow, metadata_prompt - are there for re-saving, auditing, or feeding into a downstream node that needs the original generation info (this pairs naturally with Simple Image Saver (as Forge), which can take that metadata and re-embed it). And like the text-file loader, you get batch_counter, line_counter, and lines for tracking exactly which file in the folder just got processed.

    Installing it

    ComfyUI Manager → search ComfyUI_SimpleButcher → install → restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/KLL535/ComfyUI_SimpleButcher.git
    cd ComfyUI_SimpleButcher
    pip install -r requirements.txt
    

    No model downloads involved - it's file I/O.

    Common issues

    Metadata fields come back empty. This is the single most common surprise, and it's not a bug in the node - it's a fact about the image. If a file was re-saved by a tool that strips PNG metadata (a lot of image editors do this by default, and so does re-uploading through some social platforms and messaging apps), there's simply nothing left to read. Check the source image in a metadata viewer first before assuming the node is broken.

    Batch larger than the folder. Same behavior as the text-file loader - it loops back to the start of the folder rather than erroring, so if you need strictly unique images per batch, check your file count against your batch size.

    "Random no repetitions" repeating within a run. It only guarantees no repeats for one full pass through the folder's files. Set your batch count equal to the file count if you specifically want every image touched exactly once.

    Subdirectory images not showing up. Check include_subdir - it defaults to off, and it's the first thing to check if a folder-of-folders layout seems to be missing files.

    Category📚 SimpleButcher

    Inputs (6)

    NameTypeDefaultDescription
    nameSTRINGNode name
    input_pathSTRINGPath from images will be load
    startINT0Start position for increment or decrement methods
    nextCOMBOincrementOption for enumerating files, in case of randomness the start parameter is ignored
    include_subdiroptBOOLEANfalseif True, find files include subdirectory
    countoptINT0

    Outputs (8)

    NameTypeDescription
    imageIMAGE
    maskMASK
    metadata_parameters (forge)STRING
    metadata_workflowSTRING
    metadata_promptSTRING
    batch_counterINT
    line_counterINT
    linesINT