Boyo PiD Aspect Ratio
PiD Aspect Ratios Without the Non-Square Seam Headache
- ldm_width
- ldm_height
- pid_width
- pid_height
- label
NVIDIA's PiD upscaling pipeline is picky about resolutions in a way that wastes real hours of your life. The latent-stage (LDM) resolution and the final PiD decode resolution live on different grids - multiples of 16 for one, multiples of 64 for the other - and if you feed the model an off-grid size you get a seam or a mismatched output that's annoying to debug. BoyoPiDAspectRatio exists to make that decision a dropdown instead of a spreadsheet.
It's a pure calculator: pick a profile (your PiD checkpoint tier) and an aspect_ratio, and it outputs five values - ldm_width, ldm_height, pid_width, pid_height, and a human-readable label string. Everything's hardcoded to NVIDIA's documented grid, so the numbers are always multiples of the right size.
The profiles and what they mean
There are two checkpoint profiles, both 4x decoders:
2k (512 -> 2048, 4x)- LDM base around 512px, decodes to ~2048px. For when your input is modest and you just want a clean 4x bump.2kto4k (1024 -> 4096, 4x)- LDM base at ~1024px, decodes to ~4096px. This is the profile NVIDIA's own demo runs (--resolution 4096,3072 --pid_ckpt_type 2kto4k, LDM at 1024x768) - verified against the official example, per the node's comments.
Aspect ratios available: 1:1, 4:3, 3:4, 16:9, 9:16. Pick the pair, and you get both resolutions you need: the LDM numbers go into your sampler/empty-latent setup, the PiD numbers go into the PiD decode stage.
How it works under the hood
The node looks up a static table mapping (profile, aspect_ratio) to ((ldm_w, ldm_h), (pid_w, pid_h)). For example, 2kto4k + 16:9 returns LDM 1024x576 and PiD 4096x2304. There's no computation happening - the values were pre-verified so that every LDM size is a multiple of 16 and every PiD size a multiple of 64. The label output is a formatted summary like 2kto4k (1024 -> 4096, 4x) | 16:9 | LDM 1024x576 -> PiD 4096x2304, handy for logging or wiring into a display node.
Where it fits
If you're running the NVIDIA PiD pipeline (the official inference code or a ComfyUI wrapper) inside a Boyonodes workflow, this replaces hand-calculating sizes every time you change orientation. If you're not running PiD, skip it - BoyoResolutionCalc is the pack's general-purpose aspect calculator and covers the same ground for ordinary SDXL/Wan resolutions.
Installing it
Ships with the Boyonodes pack:
cd ComfyUI/custom_nodes
git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes
Restart ComfyUI, or install via ComfyUI Manager (search "Boyonodes"). No dependencies - it's a static lookup, nothing to download. The heavy requirements.txt the pack carries is for the TTS/voice nodes and is irrelevant here.
Gotcha
The output is advisory - it tells you the correct numbers; you still have to wire them into the right inputs. And it only covers the two documented profiles; if NVIDIA ships a third checkpoint tier, this node won't know about it until the author updates the table.
A niche calculator for a niche pipeline, but it's the difference between "first try, no seam" and an afternoon of off-by-64 debugging.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| profile | COMBO | 2kto4k (1024 -> 4096, 4x) | 2 options: 2k (512 -> 2048, 4x), 2kto4k (1024 -> 4096, 4x) |
| aspect_ratio | COMBO | 16:9 | 5 options: 1:1, 4:3, 3:4, 16:9, 9:16 |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| ldm_width | INT | — |
| ldm_height | INT | — |
| pid_width | INT | — |
| pid_height | INT | — |
| label | STRING | — |