Nodes/Comfyui_PDuse/PD-selector-sum-T3
ComfyUI Node

PD-selector-sum-T3

Swapping a whole asset group when the aspect ratio changes

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD-selector-sum-T3
  • front1
  • mask1
  • back1
  • front2
  • mask2
  • back2
  • front3
  • mask3
  • back3
  • front
  • mask
  • back
  • int
  • ratio
  • width
  • height
  • X
  • Y
aspect_ratio2:3
int1768
int2680
int31024
X150.00
Y150.00
X250.00
Y250.00
X350.00
Y350.00

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_ratio isn't one of the three known ratios, it falls back to 2:3 / group 1.
  • If the selected group is incomplete - any of front, mask, or back unwired - it also falls back to group 1. So group 1 is your always-wired safety net, exactly like the 2:3 fallback in the pack's PDselector-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, default 2: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.

CategoryPDuse/Image

Inputs (19)

NameTypeDefaultDescription
front1IMAGE
mask1MASK
back1IMAGE
aspect_ratioSTRING2:3
int1INT7680–16777216
int2INT6800–16777216
int3INT10240–16777216
X1FLOAT50.00-999–999
Y1FLOAT50.00-999–999
X2FLOAT50.00-999–999
Y2FLOAT50.00-999–999
X3FLOAT50.00-999–999
Y3FLOAT50.00-999–999
front2optIMAGE
mask2optMASK
back2optIMAGE
front3optIMAGE
mask3optMASK
back3optIMAGE

Outputs (9)

NameTypeDescription
frontIMAGE
maskMASK
backIMAGE
intINT
ratioSTRING
widthINT
heightINT
XFLOAT
YFLOAT