D2_SizeSelector
Pick a size, get a latent — and why the repo is gone
- width
- height
- upscale_factor
- prescale_factor
- batch_size
- empty_latent
The size dropdown that outgrew its own repo
D2 Size Selector does one genuinely useful thing: it's a dropdown of sane image sizes that hands you a ready-made latent, so you stop hand-typing 832 x 1216 into an EmptyLatentImage every time you flip between SDXL workflows. Pick a preset, wire the empty_latent straight into your KSampler, done. The author is upfront that it's basically Comfyroll Studio's CR AspectRatio with two upgrades: the presets live in an editable config, and you get a latent (plus a few value outputs) instead of just two numbers.
But here's the thing you actually need to know first: this standalone pack is dead. The README's entire message - repeated in English, Japanese, and Chinese - is that it's been integrated into D2 Nodes ComfyUI, and the GitHub repo now returns a 404. So this page is really about a small utility that lives on, slightly renamed, inside a bigger Japanese-authored node pack. Keep that in mind before you go clone-hunting.
How it works
The mechanism is almost trivial, which is the point. A preset looks up a width/height pair from a baked-in size dictionary; the six non-custom presets are 512x512, 512x768, 1024x1024, 768x1024, 832x1216, and 1248x1632 - the SDXL-native sizes, plus one chunky hi-res option. custom falls back to the raw width/height inputs. swap_dimensions flips the pair, which is your quick portrait↔landscape toggle.
Then prescale_factor multiplies both dimensions, and the node builds an empty_latent as torch.zeros([batch_size, 4, height // 8, width // 8]). That // 8 is the VAE's spatial compression - a 1024x1024 image is a 128x128 latent with 4 channels, same compression ladder SD 1.5, SDXL, and Flux all share. There's no sampler logic, no model loading, nothing to break. It's a slightly smarter EmptyLatentImage that also tells the rest of your graph what it decided.
The inputs that matter
- preset - the dropdown.
customplus the six above. Most of the time this is the only thing you touch. - width / height - only read when preset is
custom. Set them and forget them if you live in the presets. - prescale_factor - the real sizing knob. The author's own example: width 1024 at factor 2 gives you 2048. Below 1 it shrinks, which is handy for a fast first pass.
- upscale_factor - the quiet one. It doesn't resize anything here; it's a pass-through value the README describes as "for nodes that specify a multiplier." You wire it into a hires-fix upscale step and tune the whole detail pass from one place.
- swap_dimensions and batch_size - flip orientation, and set how many images the latent holds (1–64, default 1).
The outputs
Six of them, and really one you care about: empty_latent → KSampler's latent input. The rest (width, height, upscale_factor, prescale_factor, batch_size) are the same values as INT/FLOAT outputs so you can drive an upscale node's target size or a batch-consuming node without hardcoding. For most workflows that's overkill - you'll use the latent, and maybe width/height to size an upscale.
The classic pattern, from the two-pass playbook: prescale down for the base generation, then use upscale_factor to drive a second, higher-resolution pass at low denoising strength. Native-res-first is exactly why the presets exist - every model has a resolution it was trained on, and straying far from it buys you double heads and tiling, not detail.
Install - the real way, in 2026
Don't clone the repo on this page. The standalone URL 404s, so the old git clone line just fails. Install the merged pack instead, via ComfyUI Manager (search D2 Nodes ComfyUI - or "D2 Size Selector", the old listing may still resolve to it) and restart, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/da2el-ai/D2-nodes-ComfyUI
Then restart ComfyUI. No model files, no heavy pip dependencies - the size nodes are pure torch/PIL. The catch: the merged pack registers the node under the new name "D2 Size Selector" (it's built on ComfyUI's modern V3 extension API), not the old D2_SizeSelector class. A saved workflow will throw "node type not found" and you'll swap in the new node and re-run its six wires - annoying once, then over. It also means you want a reasonably recent ComfyUI; a stale build won't see the V3 nodes at all.
Troubleshooting
- "D2_SizeSelector not found" - you're pointing at the dead pack, or the workflow predates the merge. Install D2 Nodes and replace the node.
- Size comes out smaller than you typed - the latent is
height // 8andwidth // 8, so odd dimensions silently floor. Stick to multiples of 8. - OOM when you bump prescale_factor - expected: resolution is quadratic in VRAM. Keep the base pass small and add the resolution in the second pass instead.
- Node doesn't appear in the node list - update ComfyUI; the V3 API this pack uses isn't in older releases.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 102464–8192 | — |
| height | INT | 102464–8192 | — |
| preset | COMBO | 7 options: custom, 512 x 512, 512 x 768, 1024 x 1024, 768 x 1024, 832 x 1216, +1 | |
| swap_dimensions | COMBO | 2 options: Off, On | |
| upscale_factor | FLOAT | 1.00.1–100 | — |
| prescale_factor | FLOAT | 1.00.1–100 | — |
| batch_size | INT | 11–64 | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| upscale_factor | FLOAT | — |
| prescale_factor | FLOAT | — |
| batch_size | INT | — |
| empty_latent | LATENT | — |