PDselector-image
One node that hands your workflow the right image for the current aspect ratio
- 2:3
- 1:1
- 3:2
- image
- ratio
- width
- height
Build a multi-ratio workflow - the same composition at 2:3, 1:1 and 3:2 - and you'll hit the boring problem: how do you pick which image to use based on the ratio you're currently generating? This node is the answer. It holds up to three images, keys them by ratio, and when you feed it an aspect_ratio string it passes the matching image through along with its dimensions. It's a ratio-keyed switch for images, and it saves you three bypass toggles and a tangle of "this or that" routing.
The README frames it as part of the pack's ratio toolkit, and it slots naturally next to PD:ratio selector (which computes the canvas size) and PD-selector-sum-T3 (which swaps whole asset groups). Here, you get the image half of that story.
How it works
Simple dict lookup, with one rule that matters: the 2:3 input is required, and it's the fallback. If aspect_ratio isn't one of 2:3, 1:1, 3:2, or if the matching image socket is empty, the node falls back to whatever is wired into 2:3. So 2:3 is your safety net - wire it first and the node never dies, it just always picks the 2:3 image when something's missing.
The width and height outputs are read straight off the selected image tensor, which makes this node also a cheap "image → dims" source if you're already holding an image. Pass those into an Empty Latent or a save-node prefix and the canvas always matches the artwork.
The inputs that matter
2:3(IMAGE, required) - the fallback image. Always wire this one.1:1and3:2(IMAGE, optional) - the other two ratio slots.aspect_ratio(STRING, default2:3) - the selector. Any other string falls back to2:3.
Outputs: image, ratio (the normalized ratio string), width, height.
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 ComfyUI. Pure utility, no model downloads; deps are numpy, Pillow, scipy, opencv-python, torchvision. Docs are Chinese-first, so the English in the tooltips is often all you get.
Where people get burned
Two things. First, the three hardcoded ratios - there's no way to add 4:3 or 9:16 without editing the pack's Python (py/PD_ratio_image_selector.py), so this node only makes sense for workflows that live in the 2:3/1:1/3:2 family. Second, the fallback is silent: if you set aspect_ratio = 3:2 but never wired the 3:2 socket, you'll get the 2:3 image and no error telling you why. When your output looks "wrong ratio," check the wiring, not the node.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| 2:3 | IMAGE | — | |
| aspect_ratio | STRING | 2:3 | — |
| 1:1opt | IMAGE | — | |
| 3:2opt | IMAGE | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| ratio | STRING | — |
| width | INT | — |
| height | INT | — |