Nodes/ComfyUI-GlifNodes/Image to Multiple of
ComfyUI Node

Image to Multiple of

The two-minute fix for 'latent must be divisible by 8' errors

By glifxyz·Created 3 years ago·Updated about a year ago· 65
Image to Multiple of
  • image
  • image
multiple_of64
method

You know the error. You drag an image into an img2img or ControlNet workflow, hit queue, and ComfyUI refuses because your 1000x1000 image isn't a multiple of 8 - the latent space downsamples 8x per side, and a leftover pixel has nowhere to go. Or the sampler runs but you get seams, weird crops, or a hard crash because some node needs dims divisible by 64. Image to Multiple of is the one-node answer: it snaps any image to a multiple of whatever number you pick, so it never leaves your graph.

It's the kind of boring utility node you'd normally stack from three other nodes, and honestly that's why it's good. It takes an image, rounds each side down to the nearest multiple of multiple_of (default 64, which covers the 8-divisible requirement and then some), and hands you back an image that every downstream model will happily accept.

The inputs that matter

  • multiple_of - the divisor. 64 is the safe default; use 8 if you're feeding a strict img2img pipeline that only cares about the VAE downscale, or 16 for video models with their own constraints.
  • method - center crop or rescale. Crop trims the edges symmetrically to hit the target size; rescale runs a bilinear F.interpolate and stretches the whole thing. Rescale keeps all your content but softens it slightly; crop keeps pixels untouched but eats the borders. For faces, crop; for textures, rescale.

The output is a single image, same format as the input, ready to plug into whatever was complaining.

Install

It ships in the ComfyUI-GlifNodes pack. Either search "ComfyUI-GlifNodes" in ComfyUI Manager and install it, or:

cd ComfyUI/custom_nodes
git clone https://github.com/glifxyz/ComfyUI-GlifNodes

then restart ComfyUI. The pack's only pip dependency is diffusers>=0.28.0, which Manager handles for you. This node needs none of the model downloads - it's pure tensor math, instant on CPU.

Where people get burned

The node only ever shrinks. It rounds down, so a 1001px image with multiple_of 64 becomes 960px. If you feed it an image already smaller than a multiple, it leaves that dimension alone and you silently keep your un-divisible size. If you need the canvas to grow instead - say you're preparing a ControlNet condition that must match an exact canvas - pair it with Image Padding Advanced from the same pack. Together they're a complete "make this image fit any constraint" kit.

One more thing: it operates on the image, not the latent. Put it before your encode, not after. That's the entire job - small, dull, and it unblocks more broken workflows than most fancier nodes.

Categoryimage

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
multiple_ofINT641–256
methodCOMBO2 options: center crop, rescale

Outputs (1)

NameTypeDescription
imageIMAGE