Nodes/ComfyUI-ZhiHui/📸 智绘_序列批量加载
ComfyUI Node

📸 智绘_序列批量加载

The batch-vs-counter sibling

By zhuyungen·Created 8 months ago·Updated 4 months ago· 0
📸 智绘_序列批量加载
    • 图像批次
    • 加载数量
    ◄folder_path►
    ◄start_index0►
    ◄max_images10►
    ◄skip_frames1►

    Where the pack's counter loader hands you one image per run, this node hands you a whole run of them at once - a contiguous slice of a folder loaded into a single IMAGE batch. Think video frames, animation passes, or a folder of numbered renders you want to feed into a model as a sequence in one go.

    It's ZH_ImageSequenceLoader ("📸 智绘_序列批量加载"), part of ComfyUI-ZhiHui, a Chinese-language utility pack that ports several nodes from Dapao-Toolbox. If you've never heard of the pack you're not alone - it has zero footprint in the English ComfyUI subreddits. Don't let that scare you off; the mechanics are simple and visible in the source.

    How it works

    The flow is boring in the good way: list the folder (blank path falls back to ComfyUI/input), sort by filename, slice with start_index and skip_frames, cap at max_images, convert each image to RGB, and torch.stack them into one batch. skip_frames is the knob to know - 1 loads everything, 2 loads every other frame, so you can halve the frame rate of an animation without re-encoding it. Corrupted files get skipped with a console warning rather than killing the run.

    The inputs and outputs that matter

    • folder_path - raw OS path; blank uses the ComfyUI input directory.
    • start_index - how many files to skip at the front.
    • max_images - hard cap (1–1000), defaults to 10.
    • skip_frames - decimation factor.

    Outputs are 图像批次 (IMAGE, the stacked batch) and 加载数量 (INT, how many actually loaded). Wire the batch straight into a KSampler, an upscaler that eats batches, or the pack's ZH_GridImageAssembler for a contact sheet.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/zhuyungen/ComfyUI-ZhiHui.git
    

    Restart ComfyUI. No extra dependencies beyond torch/numpy/Pillow for this node - no models to download. ComfyUI Manager search "ComfyUI-ZhiHui" works too.

    Where people get burned

    torch.stack is unforgiving: every frame has to be the same resolution or the whole load fails. The code skips broken files, but it doesn't resize mismatched frames - a folder where one image is 1024×1024 and the rest are 512×512 will error on the stack. If you're loading a mixed folder, normalize sizes first (the pack's ZH_LoadFolder node does exactly that, or use ImageMagick). And keep an eye on max_images: batches of big frames eat VRAM fast, so start small. Unlike its counter sibling, this node loads deterministically every run - no hidden state, no cache weirdness.

    Category智绘灵箱/工具箱

    Inputs (4)

    NameTypeDefaultDescription
    folder_pathSTRING图片文件夹路径(留空使用ComfyUI/input)
    start_indexINT00–10000起始索引
    max_imagesINT101–1000最大加载数量
    skip_framesINT11–100跳帧:1为全部,2为隔一帧

    Outputs (2)

    NameTypeDescription
    图像批次IMAGE—
    加载数量INT—