Nodes/ComfyUI-LogicUtils/Resize Image Ensuring W/H Multiple
ComfyUI Node

Resize Image Ensuring W/H Multiple

Snap dimensions to a clean multiple

By aria1th·Created 3 years ago·Updated 7 months ago· 116
Resize Image Ensuring W/H Multiple
  • image
  • IMAGE
multiple32
method

This one fixes a specific, annoying problem: diffusion models want dimensions that divide cleanly, and arbitrary input images don't cooperate. Feed it an image and a multiple - 32 by default - and it resizes so both width and height are exact multiples of that number. A 517×771 image becomes something tidy like 512×768. Small nudge, saves a real headache.

Why you'd care

The VAE in Stable Diffusion downsamples by a factor of 8, so any width or height that isn't divisible by 8 gets silently cropped or padded somewhere in the pipeline, and if you're unlucky it throws a shape-mismatch error instead. Plenty of workflows go further and want multiples of 32 or 64 to keep tiling, ControlNet, and latent operations aligned. This node is the "make my dimensions legal" step so you don't hit those errors after a long generation.

If you've ever had a workflow blow up with a tensor-size mismatch after loading a random image, this is the node that would have prevented it. Drop it right after your image load, before anything encodes to latent.

The inputs that matter

  • multiple (default 32) - the number both dimensions get snapped to. 8 is the bare minimum for SD's VAE; 32 or 64 is the safer, more common choice and the default reflects that.
  • method - LANCZOS, BICUBIC, or NEAREST. Since the adjustment is usually small (a few pixels), the resampling choice barely matters here, but LANCZOS stays the sensible default for real images and NEAREST is what you'd use for a mask.

image in, one IMAGE out with clean, model-friendly dimensions.

The pedigree

It's worth noting who wrote this. The pack is by aria1th (AngelBottomless), the trainer behind the Illustrious XL model series - someone whose actual work was preparing hundreds of thousands of images for training, where dimension bucketing and clean multiples are bread-and-butter concerns. This isn't a node someone invented in the abstract; it's the kind of small utility you build because you've been bitten by ragged dimensions a hundred times.

Installing ComfyUI-LogicUtils

ComfyUI Manager: Install Custom Nodes → search "ComfyUI-LogicUtils" → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/aria1th/ComfyUI-LogicUtils

Restart ComfyUI. No extra dependencies - pure Python.

Worth knowing

The pack's docs are essentially nonexistent (the author says as much in the README), but this node needs none. The only decision is what multiple your downstream steps demand: 8 if you just need it to not crash, 32 or 64 if you want everything neatly aligned for tiling and control passes. When in doubt, leave it at 32.

Categoryimage

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
multipleINT32
methodCOMBO3 options: NEAREST, LANCZOS, BICUBIC

Outputs (1)

NameTypeDescription
IMAGEIMAGE