Nodes/ComfyUI_SZtools/山竹导入图像路径列表
ComfyUI Node

山竹导入图像路径列表

Point it at a folder of training images, get IMAGE, MASK and FILE PATH lists

By Rocky-Lee-001·Created about a year ago·Updated about a year ago· 2
山竹导入图像路径列表
    • IMAGE
    • MASK
    • FILE PATH
    directory
    image_load_cap100
    start_index0
    load_alwaysfalse
    sort_method

    ShanZhuLoadImagesFromDirList is the front door of the pack's Kontext dataset workflow: you type a folder path, it loads every image in that folder, and hands you three list outputs - IMAGE, MASK, and FILE PATH. If you've used WAS Suite's or KJNodes' load-from-directory nodes, this is the same idea with a smaller feature set and a few quirks.

    The only required input is directory - an absolute path. If it's wrong or empty, the node raises a FileNotFoundError rather than silently returning nothing, which is honestly better than the alternative. The optional controls:

    • image_load_cap (default 100): max images to load; 0 means no cap.
    • start_index (default 0): skip the first N files after sorting.
    • sort_method: name, date, or size - pick how files order before any slicing.
    • load_always: force the node to re-read the folder on every queue even when its inputs haven't changed. Leave this off once your folder is final, or every run re-reads the whole set.

    Supported extensions are jpg, jpeg, png, webp and jxl. Images are exif-transposed (so phone photos come out the right way up), converted to RGB, normalized to 0–1, and returned as a list of single-image tensors. The FILE PATH output is exactly what it says - the absolute path of each file - which is how you keep track of which batch item came from which source file.

    Watch the MASK output, though: it's only a real alpha mask for images that carry an alpha channel (RGBA PNGs). For plain RGB images you get a throwaway 64×64 tensor of zeros, so don't wire MASK into something expecting a genuine selection - you'll silently feed it nothing useful.

    Where it fits

    In the pack's example workflow this node loads your raw training images, feeds them to a Florence2 interrogation pass, and the resulting captions flow through ShanZhuTextJoin into the T/R Kontext saver nodes. If you've got a folder of already-cut A/B pairs, you'd run one instance loading the references and another loading the edits. It's the least-glamorous node in the pack and arguably the one you can't do the pack's actual job without.

    Install and gotchas

    Shared pack story: ComfyUI Manager search "ComfyUI_SZtools", or git clone https://github.com/Rocky-Lee-001/ComfyUI_SZtools into custom_nodes/, restart. No model downloads; the deps (torch, numpy, Pillow) are already in ComfyUI.

    Two things to know. First, the load_always re-read behavior can be a pleasant surprise while you're still adding files - the folder shows up updated without touching the graph - but it makes every queue slower, so flip it off when you're done curating. Second, don't expect English documentation or community help: this is a Chinese-first pack by 山竹老师 ("Teacher Mangosteen") with essentially no Western footprint. It loads folders fine; it just won't hold your hand.

    Category山竹导入图像路径列表

    Inputs (5)

    NameTypeDefaultDescription
    directorySTRING
    image_load_capoptINT100
    start_indexoptINT00–18446744073709550000
    load_alwaysoptBOOLEANfalse
    sort_methodoptCOMBO3 options: name, date, size

    Outputs (3)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    FILE PATHSTRING