D2 Load Folder Images
The whole folder, loaded into one batch
- image_count
- queue_seed
- refresh_btn
- images
- image_count
D2 Load Folder Images takes every image in a folder and loads them all into a single IMAGE batch in one go. Point it at a directory of reference shots, stills, or crops, and the output is one tensor you can feed straight into a grid, a batch of samplers, or a style-transfer chain - no per-file loaders, no script to glue them together.
It's the "all at once" half of the pack's folder story. Its sibling, D2 Folder Image Queue, hands you one path at a time across automatic queue runs; use that for sequential processing like per-image img2img or caption editing. Use this node when you need everything resident in memory - which is why the docs explicitly pair it with D2 Grid Image: load a folder, grid it, done.
The inputs
folder- full path to the directory.extension- filter, default*.*. Multiple comma-separated patterns work:*.png, *.jpg, *.webp. You can even glob names, like*silver*.webp.include_subfolders- recurse (or write**infolder).sort_by-Name,Date, orRandom;order_by-A-Z/Z-A.
It shows a running image count and has a refresh_btn to rescan, plus a queue_seed slot that ties into D2's seed system for the random sort.
Outputs
images- the concatenated IMAGE batch.image_count- how many images got loaded.
Installing it
It's in the D2 pack. ComfyUI Manager → search "D2-nodes-ComfyUI" → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/da2el-ai/D2-nodes-ComfyUI
Restart. No model downloads; deps are piexif and charset-normalizer. Since v32.0.0 the pack targets ComfyUI's V3 schema - older ComfyUI builds should use a pre-32.0.0 version.
The one hard rule
This node will error out loudly if the folder contains images of different sizes - and that's a feature, not a bug. The author deliberately added an explicit error naming the offending file rather than letting torch.cat fail with an unreadable message deep in the framework. A batch must be a single resolution; if you're mixing sizes, run a resize first or sort files into same-size folders. The count output also helps you spot the case where a filter silently matched nothing - if image_count is 0, your extension pattern is the culprit.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| folder | STRING | — | |
| extension | STRING | *.* | — |
| include_subfolders | BOOLEAN | false | — |
| sort_by | COMBO | Name | 3 options: Name, Date, Random |
| order_by | COMBO | A-Z | 2 options: A-Z, Z-A |
| image_countopt | D2_SIMPLE_TEXT | — | |
| queue_seedopt | D2_SEED | — | |
| refresh_btnopt | D2_BUTTON | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| image_count | INT | — |