🪣 智绘_图像遍历加载器
Scan a whole folder of images into one batch, with filenames to match
- images_batch
- filename_text
- filename_no_ext
There's a specific ComfyUI chore this node exists for: you have a folder of images - reference photos, a frame dump, a LoRA training batch - and you want them all in the graph as one IMAGE batch, and you want to know which filename each frame came from. ZH_BatchImageLoader (🪣 智绘_图像遍历加载器) is the 智绘灵箱 pack's folder-scanner: it walks a directory (recursively if you ask), flattens every image file into a batch, lets you order or randomize it, and hands back the filenames as strings alongside the pixels. That filename output is the quietly valuable part, because the moment you start saving results you'll want to map frames back to sources.
How it works
The node caches the file list for a given folder so it isn't re-scanning the disk on every run - change the folder path and it re-scans. It reads the images with Pillow, normalizes them into tensors, and concatenates them into a single batch. load_order gives you 顺序 (Alphabetical) or 随机 (Random) - random order is handy for data shuffling in training-style flows or for a quick "grab a random reference." recursive_scan drops down into subfolders when you've got a nested directory tree.
The two pagination controls are what make this usable on big folders: start_index (skip the first N files) and limit_count (only load up to N files, 1–1000). So you can process a 5000-image folder in chunks of 500 across repeated runs - a genuinely common pattern for batch captioning or batch upscaling, and one most core loaders make you hack around.
The inputs that matter
folder_path- the whole job. Type or paste the absolute path.limit_count(default 10, max 1000) andstart_index- your chunking controls.load_orderandrecursive_scan- ordering and depth.
Outputs are three: images_batch (IMAGE) - the pixels, all in one batch; filename_text (STRING) - full filenames including extension, joined per loaded image; and filename_no_ext (STRING) - filenames minus extension, which is the one you'll actually wire into a save-name or metadata node. That's the pair that makes frame-to-source mapping painless.
Install
Part of the 智绘灵箱 (ComfyUI-ZhiHui) pack:
cd ComfyUI/custom_nodes
git clone https://github.com/zhuyungen/ComfyUI-ZhiHui.git
Restart ComfyUI (or ComfyUI Manager, "智绘灵箱" / "ComfyUI-ZhiHui"). Pillow-only at runtime.
Where people get burned
- This node does not resize. If your folder mixes 1024×1024 and 512×2048 images, the batch will error or behave badly - a tensor batch needs uniform dimensions. For mixed folders, reach for the pack's other loader,
ZH_ImageBatchLoader, which has explicit stretch/crop/pad modes. They're easy to confuse; the naming is not on your side. limit_countcaps per run, not globally. Chunking with start_index + limit_count is manual - you move the start index yourself between runs.- Random order + no seed. There's no seed control here, so "random" isn't reproducible across runs. Fine for shuffling, wrong for anything you need to re-run identically.
- Filename strings assume one image per file. If the same file is loaded twice in a batch, the filename output won't tell you which is which.
For the folder-scanning chore it's a solid, purpose-built tool - and that filename passthrough is the feature that keeps it in my loader rotation over the core LoadImage when I'm doing batch work. Just keep it pointed at uniform-size folders.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | C:/path/to/your/images | — |
| load_order | COMBO | 顺序 (Alphabetical) | 2 options: 顺序 (Alphabetical), 随机 (Random) |
| recursive_scan | BOOLEAN | false | — |
| start_index | INT | 0 | — |
| limit_count | INT | 101–1000 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| images_batch | IMAGE | — |
| filename_text | STRING | — |
| filename_no_ext | STRING | — |