WanVideoOptimalResizer
Stop hand-typing Wan resolutions — let the model's own buckets decide
- image
- image
- width
- height
Wan is picky about resolution. Alibaba's open video family (the frozen-at-2.2 base that most local video work still builds on) was trained on a small set of native resolution buckets, and feeding it anything off those buckets is how you get distorted motion, extra letterboxing, or silently wasted VRAM. WanVideoOptimalResizer exists so you never have to remember what those buckets are: give it an image, it snaps it to the closest native Wan resolution, resizes it, and hands back clean dimensions.
It's the "just make it work" node for Wan workflows. If you've ever copied a resolution table from a README into your graph by hand, this is the automation of that chore.
How it works
The pack hardcodes the Wan-native bucket lists for two presets:
- 480p: 480×832 (9:16), 832×480 (16:9), 624×624 (1:1), 704×544 (1.29:1), 544×704 (1:1.29)
- 720p: 720×1280, 1280×720, 960×960, 1088×832, 832×1088
Selection is two-stage. First it finds the candidate(s) whose aspect ratio is closest to your input - this is the priority, because Wan cares far more about shape than raw pixel count. Among ties, it picks the one with the pixel count closest to the original. That ordering is the smart part: a slightly oversized 704×544 beats an aspect-mismatched 832×480 even if the pixel counts are similar, and the VAE will thank you.
Inputs: image, resolution_preset (480p or 720p - pick by your VRAM and target quality), and upscale_method (default lanczos, which is the right choice here since the source is usually a still you're downscaling or snapping). Outputs are image, plus width and height so the rest of your graph knows exactly what it got.
Where people get burned
- It snaps, it doesn't preserve. If your source is 2:1 ultrawide or 1:1.6, the closest bucket is still a compromise - the node changes the aspect ratio on purpose. That's the deal with bucket systems; check the console output, which prints the aspect-ratio delta so you can see how much it bent your image.
- It can upscale. A tiny source will get pulled up to the bucket. If you want pixel-limited output instead of bucket-snapped output, that's the same pack's PixelLimitResizer.
- It's Wan-specific. These buckets belong to Wan 2.1/2.2. Using it for, say, LTX or Hunyuan is cargo-culting someone else's training distribution.
Install
Ships in ComfyUI-keitNodes. ComfyUI Manager, search "ComfyUI-keitNodes", install, restart - or:
cd ComfyUI/custom_nodes
git clone https://github.com/keit0728/ComfyUI-keitNodes
cd ComfyUI-keitNodes
pip install -r requirements.txt
Then restart. No model downloads - all the "intelligence" is a list of five tuples and an aspect-ratio comparison. The heavy lifting is ComfyUI's own common_upscale, which you already have.
If you don't need the actual resize - just want to know what resolution Wan would choose, so you can drive your own latent or batch multiple images to a common size - grab the pack's WanVideoResolutionFinder instead. Same algorithm, zero image processing, just the two integers.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| resolution_preset | COMBO | 480p | 2 options: 480p, 720p |
| upscale_method | COMBO | lanczos | 5 options: nearest-exact, bilinear, area, bicubic, lanczos |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |