PD_load image path
Load every image in a folder as a list — masks included
- image_list
- mask_list
- name_list_str
- count
Batch workflows want a folder of images, not a hand-picked file. PD_LoadImagesPath ("PD_load image path") is the folder loader: point it at a directory and it returns every image in it as a list, plus the matching alpha masks as a second list, plus the filenames and a count. It's the load side of the batch pipeline that the same pack's save nodes are the store side of, and it's the node you want when a training-prep or bulk-process workflow needs to chew through a whole directory in one run.
It's from 7BEII/Comfyui_PDuse, and it's the folder-loading cousin of PD_ImageSearch (that one filters by filename keyword; this one takes everything in order).
How it works
It lists the directory, keeps files with image extensions (png, jpg, jpeg, webp, bmp, tiff), sorts them, and loads each one into a list of IMAGE tensors. For images with an alpha channel, the transparency becomes a MASK on the same index - so a list of transparent PNGs comes out with image_list[i] and mask_list[i] referring to the same file, which is exactly the pairing you need before feeding things into an inpainting or compositing step. name_list_str is the filenames joined with newlines, and count is how many files made it in.
One piece of behavior worth knowing: if the path doesn't exist or is empty, it doesn't crash - it returns a single blank 64×64 black image, an empty mask, an empty name string, and count = 0. That's a deliberate "fail soft" so a batch job doesn't die on a typo, but it means you should check count before trusting the output, because a blank frame downstream is a silent failure.
The inputs that matter
directory_path- the folder to load from. An absolute path on your machine.limit_count- cap on how many files to read;0(the default) means unlimited. If you've got a folder of 8,000 frames and only want the first 500, set this.
Outputs: image_list (list), mask_list (list), name_list_str (STRING), count (INT). The lists are marked as lists, so they'll plug into list-aware nodes for per-item processing.
Installing
ComfyUI Manager, search Comfyui_PDuse; or:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse
cd Comfyui_PDuse
pip install -r requirements.txt
Restart. No models.
Gotchas
Chinese README, non-recursive scan (subfolders ignored), and it loads the whole folder into memory - a few thousand large images can eat your RAM, so use limit_count for exploratory runs. The mask list is only populated for images that actually have alpha; a folder of opaque JPGs gives you an empty mask list even though the images load fine, so don't wire mask_list into something that requires it without checking. And the "blank 64×64 on missing path" fallback is the subtle one - always gate downstream work on count > 0. For the everyday case - "run this img2img chain over a whole folder" - this node plus the pack's save node is a clean, working loop.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| directory_path | STRING | — | |
| limit_count | INT | 00–10000 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image_list | IMAGE | — |
| mask_list | MASK | — |
| name_list_str | STRING | — |
| count | INT | — |