PD-selector-sum-T3
Swapping a whole asset group when the aspect ratio changes
- front1
- mask1
- back1
- front2
- mask2
- back2
- front3
- mask3
- back3
- front
- mask
- back
- int
- ratio
- width
- height
- X
- Y
You're building one of those multi-layout workflows - same sticker design, three aspect ratios, each with its own front image, mask, background, integer, and placement coordinates. The naive way is three copies of the pipeline and a mess of bypasses. The PDuse way is PD-selector-sum-T3: one node holds up to three complete groups of assets, keys them by ratio, and when you flip aspect_ratio it hands you the whole matching bundle - images, mask, background, and the X/Y position - on one set of wires. It's the ratio-keyed "asset group switch" and it's the most ambitious node in the pack's ratio toolkit.
It's designed to be the downstream of PD:ratio selector: that node computes the canvas for a ratio, this one picks the assets that go on that canvas. Together they keep a three-layout workflow from drifting out of sync.
How it works
Internally it's a dict of three groups - 2:3 is group 1 (the required one), 1:1 group 2, 3:2 group 3. Each group carries a front image, a mask, a back image, an int value, and an X/Y position. When aspect_ratio changes, it looks up the group and passes every member out. Two fallback rules from the source:
- If
aspect_ratioisn't one of the three known ratios, it falls back to2:3/ group 1. - If the selected group is incomplete - any of
front,mask, orbackunwired - it also falls back to group 1. So group 1 is your always-wired safety net, exactly like the2:3fallback in the pack'sPDselector-image.
The width/height outputs are read off the selected back image, so the canvas dims always match the background that's currently live. The int output is the group's integer (defaults 768/680/1024, which line up with the pack's ratio selector defaults) and X/Y are the placement floats (default 50, i.e. centered).
The inputs that matter
front1/mask1/back1- group 1, required, the fallback.front2/mask2/back2,front3/mask3/back3- optional groups 2 and 3.aspect_ratio(STRING, default2:3) - the selector.int1..3,X1..3,Y1..3- per-group value and position.
Outputs: front, mask, back, int, ratio, width, height, X, Y.
Installing it
Part of Comfyui_PDuse by 7BEII. ComfyUI Manager (search "PDuse") or:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse.git
cd Comfyui_PDuse
pip install -r requirements.txt
Restart. No model downloads; pack deps are numpy, Pillow, scipy, opencv-python, torchvision. Chinese-first docs.
Where people get burned
The fallback is silent. Wire 3:2 assets but forget the mask, flip to 3:2, and you'll quietly get group 1 instead of an error - when the output "looks like the wrong layout," that's the first thing to suspect. Also, group 1 is required even if you only ever plan to use 1:1, so you always need a full default set wired. And the ratios are hardcoded at those three; the pack's other selector has the same constraint, so this whole family is for 2:3/1:1/3:2 pipelines, full stop.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| front1 | IMAGE | — | |
| mask1 | MASK | — | |
| back1 | IMAGE | — | |
| aspect_ratio | STRING | 2:3 | — |
| int1 | INT | 7680–16777216 | — |
| int2 | INT | 6800–16777216 | — |
| int3 | INT | 10240–16777216 | — |
| X1 | FLOAT | 50.00-999–999 | — |
| Y1 | FLOAT | 50.00-999–999 | — |
| X2 | FLOAT | 50.00-999–999 | — |
| Y2 | FLOAT | 50.00-999–999 | — |
| X3 | FLOAT | 50.00-999–999 | — |
| Y3 | FLOAT | 50.00-999–999 | — |
| front2opt | IMAGE | — | |
| mask2opt | MASK | — | |
| back2opt | IMAGE | — | |
| front3opt | IMAGE | — | |
| mask3opt | MASK | — | |
| back3opt | IMAGE | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| front | IMAGE | — |
| mask | MASK | — |
| back | IMAGE | — |
| int | INT | — |
| ratio | STRING | — |
| width | INT | — |
| height | INT | — |
| X | FLOAT | — |
| Y | FLOAT | — |