Nodes/ComfyUI-keitNodes/PixelLimitResizer
ComfyUI Node

PixelLimitResizer

PixelLimitResizer (16×)

By keit0728·Created about a year ago·Updated about a year ago· 3
PixelLimitResizer
  • image
  • image
  • width
  • height
  • aspect_ratio
  • resize_info
upscale_methodlanczos
max_pixels589824

Plain ComfyUI image resizing is easy. Resizing for a video model is where people lose an afternoon to VAE errors and weird tile seams, because video backbones like Wan and LTX use a 3D causal VAE with heavy spatiotemporal compression - dimensions that aren't multiples of the compression factor get rejected or produce artifacts. PixelLimitResizer is the pack's answer to that: it resizes your image to fit inside a pixel budget and snaps both dimensions to multiples of 16, which is exactly what those 3D VAEs want (Wan's VAE compresses spatial 8×8 and temporal 4× - a 256× compression - so 16-aligned frames divide cleanly).

It's the node in this pack I'd actually reach for by default when I'm conditioning an image for video generation. If you've been hand-typing 1024×576 into an Empty Latent and hoping, this replaces the guesswork.

How it works

The core is a small search over height. It starts from the theoretical max height inside your pixel budget (sqrt(max_pixels / aspect_ratio)), steps down in multiples of 16, and for each height tries floor and ceil widths that are also 16-multiples - then keeps the combo that gets closest to filling the budget. Read that twice, because it has a consequence most people miss:

It maximizes, not just caps. If your source image is smaller than the budget, this node will upscale it to fill the budget, not leave it alone. That's deliberate - it's trying to hand the VAE the largest valid resolution - but it means "I just want to shrink this" is the wrong mental model. Set max_pixels to the ceiling you actually want.

Inputs are simple: image, upscale_method (nearest-exact, bilinear, area, bicubic, lanczos - lanczos is the right default for downscaling), and max_pixels (256 to ~4.2M, default 589,824, which is exactly 1024×576 - the sort of budget a mid-range GPU can actually chew through for a video).

Outputs worth knowing

  • image - the resized tensor.
  • width, height - the 16-aligned dimensions.
  • aspect_ratio - a FLOAT you can route to conditioning or debug.
  • resize_info - a STRING with the full before/after story. Wire it into a text display node when you're troubleshooting why a video came out at an unexpected size; it saves a lot of squinting at the console.

Common issues

  • Images come back bigger than the source. Expected, given the "fill the budget" behavior above. If that surprises you, it's not broken.
  • Latent size mismatch. This outputs pixels. If you feed it into a latent pipeline, the latent dimensions must match - 1024×576 at 8× compression is a 128×72 latent. Wire width/height into your latent node rather than assuming.
  • Don't expect generative detail. This is a pure interpolation resizer - it's the "more pixels, no hallucinated detail" end of the upscaling spectrum. For restoring soft sources you want a generative upscaler, not this.

Install

Part of ComfyUI-keitNodes - Manager search "ComfyUI-keitNodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/keit0728/ComfyUI-keitNodes
cd ComfyUI-keitNodes
pip install -r requirements.txt

Restart and you're done. No models, no weights, no downloads - the only "dependency" is ComfyUI's own comfy.utils.common_upscale, which every ComfyUI already ships.

CategorykeitNodes

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
upscale_methodoptCOMBOlanczos5 options: nearest-exact, bilinear, area, bicubic, lanczos
max_pixelsoptINT589824256–4194304Maximum pixel count limit (width × height). The image will be resized to stay within this limit while maintaining aspect ratio and 16-pixel alignment. Default: 589824 pixels (ex: 1024×576)

Outputs (5)

NameTypeDescription
imageIMAGE
widthINT
heightINT
aspect_ratioFLOAT
resize_infoSTRING