Nodes/ComfyUI-TrainTools-MZ/MinusZone - LoadImagesFromDirectoryPath
ComfyUI Node

MinusZone - LoadImagesFromDirectoryPath

Images from a folder path, straight into a batch

By MinusZoneAI·Created 2 years ago·Updated 5 months ago· 67
MinusZone - LoadImagesFromDirectoryPath
    • images
    directoryX://path/to/images

    MZ_LoadImagesFromDirectoryPath is the pack's utility node, and it does exactly what it says: give it a directory path and it loads every image in that folder into a single IMAGE batch. It exists because the pack's training graph wants to start from an image batch, and ComfyUI's stock Load Image only handles one file at a time. This is the "grab a whole folder" shortcut.

    Honestly, it's the least glamorous node in the pack, but it's also the most reusable. You can use it to seed the dataset step with a folder you already prepared on disk - which is genuinely handy when your training images live in a folder you've been curating for weeks rather than something you want to drag through the UI.

    How it works

    The node takes a single directory input (a STRING, default placeholder X://path/to/images), lists the folder's contents, keeps the .png, .jpg, and .webp files, opens them with PIL, converts each to a tensor, and stacks them into one batch. Output is images (IMAGE), ready to feed MZ_KohyaSSDatasetConfig / MZ_ImagesCopyWorkspace, or any other node that takes an image batch.

    Two realities to set expectations:

    • If the directory doesn't exist, it returns an empty batch rather than erroring - which is forgiving but also means a typo'd path silently produces "no images" downstream. Check your path.
    • The file filter has a real quirk in the shipped source: the .webp check references an undefined variable, so while .png and .jpg filter cleanly, a folder containing only .webp files will error out. Load order also isn't sorted, so if you need deterministic order (matching conditioning_images one-to-one for a controlnet dataset, say), sort the folder yourself or use a loader that guarantees order.

    Install & troubleshooting

    It ships with the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MinusZoneAI/ComfyUI-TrainTools-MZ
    # restart ComfyUI
    

    Or ComfyUI Manager → search ComfyUI-TrainTools-MZ. No model downloads, no extra dependencies beyond pillow, which ComfyUI already has.

    The practical workflow: point this at your prepared dataset folder, wire images into the dataset config node, and you've skipped the load-everything-through-the-graph dance. If your dataset step then complains about nothing being copied, that empty-batch-on-bad-path behavior is the first thing to check - and if you're loading .webp, convert to png first, both for this loader's filter quirk and because webp is where the pack's own image-saving default already causes headaches.

    CategoryMinusZone - TrainTools/tools

    Inputs (1)

    NameTypeDefaultDescription
    directorySTRINGX://path/to/images

    Outputs (1)

    NameTypeDescription
    imagesIMAGE