Nodes/D2 Nodes ComfyUI/D2 Load Folder Images
ComfyUI Node

D2 Load Folder Images

The whole folder, loaded into one batch

By da2el-ai·Created 2 years ago·Updated about a month ago· 66
D2 Load Folder Images
  • image_count
  • queue_seed
  • refresh_btn
  • images
  • image_count
folder
extension*.*
include_subfoldersfalse
sort_byName
order_byA-Z

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 ** in folder).
  • sort_by - Name, Date, or Random; 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.

CategoryD2/Image

Inputs (8)

NameTypeDefaultDescription
folderSTRING
extensionSTRING*.*
include_subfoldersBOOLEANfalse
sort_byCOMBOName3 options: Name, Date, Random
order_byCOMBOA-Z2 options: A-Z, Z-A
image_countoptD2_SIMPLE_TEXT
queue_seedoptD2_SEED
refresh_btnoptD2_BUTTON

Outputs (2)

NameTypeDescription
imagesIMAGE
image_countINT