ZML_变量_图像文件夹
Fan a whole folder of images across parallel runs, one per thread
- 输入变量包
- 输出变量包
This is the parallel-variable node that finally makes sense of the whole family. ZML_变量_图像文件夹 takes a folder path, scans it for images, and hands each run of a subworkflow a different file path. Run 1 gets the first image, run 2 the second, and so on - which is the classic "process my whole folder in parallel" use case, and honestly the one you'll actually want.
Mechanically, the source does exactly what you'd hope: it globs *.jpg, *.png, *.webp, *.jpeg (both cases) in the folder, dedupes and sorts the list, and stores it as a list variable in the bundle. The container picks values[index % len(values)], so the list cycles if you run more times than there are files. The resolved value - a path string - replaces every {{占位符}} marker in your API JSON. Inside the sub-workflow, ZML_SubflowLoadImage is the node that takes that path string and turns it into a real IMAGE tensor.
What to set
- 文件夹路径 - STRING, default
C:\. Point it at the folder (an absolute path works fine). - 占位符 - STRING, default
图像文件夹. The{{name}}marker in your JSON template. - 输入变量包 (optional) - merge onto an existing bundle, e.g. alongside an int node for a per-run index.
Output: 输出变量包 (VAR_BUNDLE).
The flow that works
The winning combo the README describes is the folder variable plus the integer variable: the folder gives you the list of image paths, the int node counts 0,1,2…, and your sub-workflow JSON indexes into the list with {{索引}} while loading {{图像文件夹}}'s value. That gives you deterministic per-run images without the bundle cycling underneath you.
Two caveats worth knowing. First, this parallel system is built for API calls and light logic - the README's headline examples are parallel watermarking and 8-thread HTTP batches. Real sampling inside the container won't magically parallelize across GPUs. Second, the pack is one person's 160+-node project, and the author is upfront that the subworkflow family is their daily driver (so it's well-tested) but that other nodes may be buggy; issues and PRs on the repo are the support path.
Install
One pack, one install: ComfyUI Manager → search ComfyUI-ZML-Image, or
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
then restart. No models to download, no heavy deps beyond what ComfyUI already ships. English users: grab the README's linked translation patch - the UI labels and placeholders are Chinese-first. If your first run returns an "未找到导出节点" (export node not found) status, your JSON template is missing the ZML_SubflowExportImage / ZML_SubflowExportAny output nodes - that's the container's signal for what to return.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| 文件夹路径 | STRING | C:\ | — |
| 占位符 | STRING | 图像文件夹 | — |
| 输入变量包opt | VAR_BUNDLE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 输出变量包 | VAR_BUNDLE | — |