🐳批量加载
The folder loader that actually reads your whole dataset
- 图像批次
- 文本内容
- 文件总数
- 文件信息
- 统计信息
Smart Batch Loader (🐳批量加载) is the node you reach for when the stock Load Image stops scaling: instead of dragging fifty files into a node, point this at a folder and let it hand you batches of images, text captions, or paired image+text - optionally shuffled, grouped, and resized on the way in. It's the front door for batch img2img, caption-based workflows, and any "run this over a whole directory" job where you don't want to rebuild the graph per file.
Mechanically it's a folder scanner with opinions. You give it a folder_path, pick a file_type (图像 image, 文本 text, 混合 mixed, or 图像+文本 image+text pairing), and it lists the matching files. batch_size (1-64) sets how many it returns per run, start_index picks where in the list to begin (with wraparound, so it never runs out of files), and shuffle + seed (seed -1 means random each run) give you reproducible shuffling for training or variety jobs. group_by (extension, prefix, or date) is the interesting one - it groups files and then loads from the largest group, which is how you say "only the jpgs, not the pngs" or "only this batch's numbered prefix" without pre-sorting the folder.
resize_mode + target_size handle the resolution question at load time: 缩放 (resize, aspect-preserving via LANCZOS), 裁剪 (center crop to a square target), or 填充 (pad with black to the target). Doing this at load keeps the rest of your graph simple - every image arrives at a uniform size, which a batch workflow generally needs anyway.
The outputs
Five outputs, and most of them are about knowing what you loaded:
图像批次- the actual IMAGE batch文本内容- the loaded text/caption (in image+text mode, paired by filename or picked randomly viatext_mode)文件总数- count, handy for wiring into loops or math文件信息- a LIST of per-file details统计信息- a DICT with stats
That metadata pair is the reason this node beats a plain Load Image loop - you can log what ran, or wire 文件总数 into a counter for a controlled loop over every file. It's also marked as an output node, so it behaves like a proper entry point you build a workflow around.
Honest gripes: batch_size with a fixed start_index means consecutive runs don't advance the window by themselves - you have to move start_index between runs, or rely on shuffle. And "mixed" mode is a grab-bag; if your folder has both images and text and you actually want them paired, use 图像+文本 mode instead.
Install
Part of Pond Nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Pondowner857/comfy_Pond_Nodes
cd comfy_Pond_Nodes
pip install -r requirements.txt
Restart after (or Manager → search "comfy_Pond_Nodes"). No model files needed. The README's standing caveat applies: if your console is spammed after install, the pack conflicts with comfyui_HiDream-Sampler - drop one of them.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | — | |
| file_type | COMBO | 图像 | 4 options: 图像, 文本, 混合, 图像+文本 |
| batch_size | INT | 11–64 | — |
| start_index | INT | 00–99999 | — |
| shuffle | BOOLEAN | false | — |
| seed | INT | -1-1–18446744073709550000 | — |
| group_by | COMBO | 无 | 4 options: 无, 扩展名, 前缀, 日期 |
| resize_mode | COMBO | 无 | 4 options: 无, 缩放, 裁剪, 填充 |
| target_size | INT | 51264–2048 | — |
| text_mode | COMBO | 配对 | 2 options: 配对, 随机 |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| 图像批次 | IMAGE | — |
| 文本内容 | STRING | — |
| 文件总数 | INT | — |
| 文件信息 | LIST | — |
| 统计信息 | DICT | — |