PDimage_dual_batch_v1
PDimage_dual_batch_v1 — load two folders and get aligned _R/_T pairs out the other side
- image1_batch
- image2_batch
- info
This is the disk-based version of the same trick as the pack's PD双图批处理(列表输入): instead of handing it image lists plus name lists, you give it two folder paths and it loads, matches, and aligns the images for you. Same name-based pairing logic, zero typing of filenames.
If your workflow looks like "folder A has the _T renders, folder B has the _R renders, and I need them paired frame-for-frame" - which is the shape of a lot of caption-comparison and training-prep pipelines - this node saves you the entire manual step of checking that index 12 on one side actually corresponds to index 12 on the other.
How it works
It scans each folder for images (.jpg/.jpeg/.png/.bmp/.tiff/.webp), strips extensions, and builds a name→file map. Then it runs the same matching ladder as the list-input twin, with name1_suffix and name2_suffix (defaults R and T):
- Suffix:
65_T↔65_R, with or without the underscore. - Prefix:
T1_00001↔R1_00001. - Middle replacement:
65_T_00001↔65_R_00001.
Each found pair becomes one entry, matched names are consumed so nothing pairs twice, and the result is sorted by base name so the output order is stable and predictable. only_first limits the run to the first pair, useful for testing the pipeline with one example before committing to the whole batch.
The inputs that matter
- image1_path / image2_path (
STRING) - the two folder paths, typed in (no picker - the pack uses plain text paths everywhere). - name1_suffix / name2_suffix (
STRING, defaultsR/T) - the distinguishing tokens. - seed (
INT) and only_first (BOOLEAN, default off).
Outputs: image1_batch and image2_batch (image lists, per-frame), plus info (STRING) reporting what matched and how.
The gotchas
The pair output is a list of single-frame images, not one big batch tensor - the node sets OUTPUT_IS_LIST = (True, True, False). That's deliberate: it keeps the pairing intact when you fan pairs out to per-pair processing (detail loops, per-pair diffs). If a downstream node expects a plain IMAGE batch, you may need to merge or index the list.
Also, matching is strict about the two sides lining up: if a base name exists in folder 1 but has no counterpart in folder 2, that file is silently skipped rather than paired against nothing. That's the right call - a half-pair is worse than no pair in training data. But it means your info string is worth reading, because it's the only place you'll see that something got dropped.
Install
ComfyUI Manager: search PDuse (repo 7BEII/Comfyui_PDuse), install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse
cd Comfyui_PDuse
pip install -r requirements.txt
Restart and it appears as PDimage_dual_batch_v1 under PD_Tools/image_processing. Folder in, aligned pairs out - the least effort you'll ever spend getting two image sets to agree on an order.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image1_path | STRING | — | |
| name1_suffix | STRING | R | — |
| image2_path | STRING | — | |
| name2_suffix | STRING | T | — |
| seed | INT | 00–18446744073709550000 | — |
| only_first | BOOLEAN | false | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image1_batch | IMAGE | — |
| image2_batch | IMAGE | — |
| info | STRING | — |