Ard Remainder
The one-job node that keeps your latent dimensions legal
- integer
ARD Remainder is the node you add after you've typed a width like 1030 and stared at the "not divisible by 8" error for the third time. It takes one integer and rounds it up to the nearest multiple of another integer. That's the whole job, and it's a job worth having.
Why does divisibility matter at all? The VAE downsamples by 8x per side on SD 1.5 and SDXL, so latents that aren't multiples of 8 either fail or force ComfyUI to silently pad. Newer models tightened it further - Flux generally wants multiples of 64, and a lot of the annoying "wrong dimension" errors you'll hit mid-workflow are just this. So instead of doing mental math every time you change a number, you drop this node in front of whatever computes your dimensions and let it clean up.
How it works
The math is boring in the good way. Feed it Ix (the integer to fix, default 1024) and Dx (the divisor you need to be divisible by, default 8). If Ix is already a multiple of Dx, it passes through untouched. Otherwise it adds Dx - (Ix % Dx) - so 1030 with a divisor of 8 becomes 1032, and 1025 becomes 1032. It's a ceiling, not a round. If you set Dx to 0 it prints an error to the console and returns your Ix unchanged rather than crashing, which is a nice touch for a utility node.
Output is a single INT named integer. Wire it into anything that takes a dimension - an Empty Latent, a KSampler's width/height, or the width/height inputs on the pack's ARD Control Box.
Install
This ships in the ComfyUI-Ardenius pack. The easy route is ComfyUI Manager - search "Ardenius" and install ComfyUI-Ardenius. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ArdeniusAI/ComfyUI-Ardenius
Restart ComfyUI and the node appears under the Ardenius category (double-click and search "Ard Remainder"). No model files, no extra downloads - it's pure arithmetic. The pack's requirements.txt does list civitai and moviepy, which Manager will install for you; they're not needed for this node, just keep them if the whole pack is in play.
The honest caveat
Two things. First, it only ever rounds up, so if your max is 1024 and you feed it 1022, you get 1024 - but feed it 1025 and you get 1032, quietly over your cap. Second, ComfyUI's built-in Math Expression node can do the same thing with ((x + d - 1) // d) * d. This node isn't magic; it's convenience and a few fewer keystrokes. If you're already using the Ardenius pack, it's the tidier option - and it makes a genuinely decent "snap dimensions" utility when you're doing batch aspect-ratio work. If you're not in the pack, the built-in will do. Where people get burned: assuming it rounds to nearest. It doesn't. If that's what you need, look elsewhere.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| Ix | INT | 1024 | input an integer |
| Dx | INT | 8 | if integer Ix is not divisible by Dx it will add to it to make it divisible |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| integer | INT | — |