PD双图批处理(列表输入)
PD双图批处理(列表输入) — pair up your _R and _T image sets without eyeballing filenames
- image1_list
- image2_list
- image1_batch
- image2_batch
- info
Training data workflows live on paired image sets: 65_R.png and 65_T.png, same base name, different variant suffix - the convention behind most AI Toolkit-style caption setups. If you've ever tried to feed both sides of a pairing into ComfyUI as two aligned batches, you know the pain: the load order of two folders almost never matches, and a silent misalignment corrupts every pair downstream.
This node (the display name is Chinese: PD双图批处理(列表输入) - "dual-image batch processing, list input") is the fix. It takes two image lists plus two filename lists, matches them by name, and spits out two aligned batches with an info string telling you exactly what matched and how. The README frames it as smart filename matching supporting suffix, prefix, and replacement strategies - which is exactly what _R/_T pairing needs.
How it works
The key mechanic is INPUT_IS_LIST = True: ComfyUI is told not to auto-collapse your lists into a single batch, so the node sees each image separately and can pair them one-to-one. It parses name1_list/name2_list (one name per line) and runs a matching ladder against name1_suffix/name2_suffix (defaults R and T):
- Suffix -
65_Tpairs with65_R(and_T/_Rwith underscores). - Prefix -
T1_00001pairs withR1_00001. - Replacement -
65_T_00001pairs with65_R_00001by swapping the token in the middle.
It validates that the number of names equals the number of images per side, errors loudly if a match is missing, and with only_first on, returns just the first pair. The seed input seeds the RNG for reproducibility, but the pairing itself is deterministic name-matching - you can leave it at 0.
The inputs that matter
- image1_list / image2_list (
IMAGE) - the two sets. - name1_list / name2_list (
STRING, multiline) - filenames, one per line, same order as the images. - name1_suffix / name2_suffix (
STRING, defaultsR/T) - the tokens that distinguish the two sets. - seed (
INT) and only_first (BOOLEAN, default off).
Outputs: image1_batch and image2_batch (both image lists), plus info (STRING) with the match report.
The honest gotchas
This node expects you to already have the images in ComfyUI with their names available - you pair it with the pack's list-producing loaders (like the ZIP/txt list readers) or any loader that also emits filenames. If you've got two folders on disk instead of in-memory lists, use the pack's PDimage_dual_batch_v1, which takes folder paths directly - same matching logic, no name typing.
And the requirement that name-count equals image-count is strict. If ComfyUI collapses your list into one batch upstream (a batch tensor, not a list), the node will tell you counts don't match. When that happens, check what's actually on the wire before blaming the node.
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 under PDuse/Image (search PD双图批处理 or PDimage_dual_batch). For caption/training pairs where alignment is non-negotiable, this is the node that removes the manual cross-check.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image1_list | IMAGE | — | |
| image2_list | IMAGE | — | |
| name1_list | STRING | — | |
| name2_list | STRING | — | |
| name1_suffix | STRING | R | — |
| 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 | — |