WAN Resolution Snap
Stop Guessing WAN's Magic Number — Snap It to 32
- width
- height
- width_float
- height_float
- summary
Somewhere along the way someone tells you Wan needs its latent dimensions divisible by 32, and you spend the next hour typing 1000 x 540 into EmptyLatentImage and wondering why the output looks like a VHS tape left in the sun. WAN Resolution Snap is the fix for that: you feed it a resolution you want, it hands back the resolution Wan will actually behave at.
It comes from Enviral Design Node Pack, a deliberately small, dependency-light utility pack that exists so you don't pull in a giant custom-node bundle to solve one glue problem. There are no model downloads, no CUDA calls, no sampling - this node is pure integer math. The name might sound like a sampler, but it never touches your model. It just computes numbers, which makes it boring in the best possible way.
How it works
Wan's 3D causal VAE works in blocks of 32 pixels, and if your width or height isn't a multiple of 32 you get seams, warping, or a flat-out refusal from the model. The node takes your requested width and height, then rounds each one to the nearest multiple of your divisible_by (32 by default) using one of three snap modes:
- nearest - rounds up or down to the closest multiple. The default, and what you want 99% of the time.
- floor - always rounds down, so your video never exceeds the resolution you asked for. Handy when VRAM is the constraint (and with Wan, VRAM usually is).
- ceil - always rounds up, for when you need at least that many pixels.
The math clamps each dimension to a sane range, and the swap toggle flips width and height before snapping - so 1280 x 704 landscape becomes 704 x 1280 portrait without you doing the arithmetic.
The inputs and outputs that matter
You'll touch three inputs in practice:
- preset - a dropdown with sensible Wan starting points: squares from 512 to 1024, 16:9 (
1024 x 576,1280 x 704), 9:16 (576 x 1024,704 x 1280,768 x 1344), and 4:3 (896 x 672). All presets are already divisor-safe, so snapping never changes them. - width / height - only used when preset is
custom. This is where you type the oddball resolution you actually want; the tooltip spells out that unsafe values get snapped internally. - divisible_by - the divisor. 32 is right for Wan; bump it to 64 or 128 only if a LoRA or workflow demands it.
Outputs are where this node earns its keep. You get width and height as INTs (wire them into EmptyLatentImage or a Wan video sampler), plus width_float and height_float for the handful of video/upscale nodes that insist on float sockets - no converter node needed in between. And summary, a string like:
768 x 1344 | 1.03 MP | 4:7 | div32 | from 1000 x 540
That string is the best part: megapixel count, reduced aspect ratio, and - when snapping actually changed something - your original size. Drop it into a text display node and you always know what the model really got, which is exactly the kind of feedback you want when you're chasing a VRAM overflow or a blurry region.
Install
ComfyUI Manager has it - search "Enviral Design Node Pack". Or clone it directly:
cd ComfyUI/custom_nodes
git clone https://github.com/EnviralDesign/comfyUI-enviral-design-node-pack
Restart ComfyUI and you're done. No model downloads, no weights, no keys. The pack's only declared dependency is color-matcher, which this node doesn't even touch - that's for the color-match nodes elsewhere in the pack.
Common issues
Honestly, not much goes wrong with a node that only does division. The one gotcha: width and height are ignored when a preset is selected. If you set custom, then later pick 1024 x 576 and change width, nothing happens - that's the dropdown doing its job, not a bug. And if you're getting a "from 1000 x 540" line in summary, that's your cue that your custom size was off-divisor and got corrected; if the corrected size surprises you, that's usually a sign you should pick a preset or pick numbers closer to a multiple of 32 to begin with.
One light aside: it's a niche tool, but it's the kind of niche that saves you ten minutes a workflow once video generation is on your machine. Snap once, wire it in, and move on to the part that actually matters - the prompt.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| preset | COMBO | custom | 15 options: custom, 512 x 512, 640 x 640, 704 x 704, 768 x 768, 1024 x 1024, +9 |
| width | INT | 5121–16384 | Used when preset is custom. Unsafe values are snapped internally. |
| height | INT | 5121–16384 | Used when preset is custom. Unsafe values are snapped internally. |
| snap | COMBO | nearest | How to quantize width and height to the selected divisor. |
| divisible_by | INT | 321–1024 | — |
| swap | BOOLEAN | false | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| width_float | FLOAT | — |
| height_float | FLOAT | — |
| summary | STRING | — |