BitPoet Closest Multiple (w+h)
Round Your Canvas to a Multiple of 16 Without Thinking
- width
- height
- base
- up
- width
- height
Every model you run wants canvas dimensions that divide cleanly. Ideogram 4 and Flux 2 want multiples of 16, SDXL-class models want multiples of 8, and sooner or later you will type 1050×930 into a sampler and get an image with a broken edge that looks like a bad composite. This node exists to stop that specific kind of self-inflicted wound.
BitPoet Closest Multiple (w+h) takes a width and height, and returns the nearest multiple of a base in whichever direction you ask. Two ints in, two ints out, no images, no VRAM, nothing to download. It's arithmetic with a UI.
How it works
For each dimension independently it does the obvious thing: round up to the next multiple of base, or down to the previous one. Round-up returns the input unchanged if it's already a multiple; round-down always shaves off the remainder. There's no actual "nearest" mode - the name is a small lie. With up on, 1050 becomes 1056, not 1040; with up off it becomes 1040. If you genuinely want the closest multiple you can't get it from this node, but for sizing latents before sampling you usually want up anyway.
The inputs that matter
- width / height (INT, default 1024) - the numbers you want fixed.
- base (INT, default 16, 0–128) - the modulus. Leave it at 16 for Ideogram 4 and Flux 2 (their VAE downsamples by 16×, so a 16-multiple latent maps cleanly back to pixels); drop to 8 for the SDXL family.
- up (BOOLEAN, default true) - rounds up when checked, down when not.
Outputs are just width and height as INTs, which you wire straight into an Empty Latent Image or into the width/height inputs of a conditioning node.
Why it ships in this pack
This isn't the pack's main event. It's a helper that BitPoet (the author) needed while building the pack's real purpose - the Ideogram 4 reference-conditioning node, which demands a latent whose spatial size is an exact multiple of 16 to match the Flux 2 VAE. It got bundled because it's tiny and he already had it. You don't need Ideogram 4 to use it, though; it's a perfectly general canvas-sizing helper.
Installing it
ComfyUI Manager (search "ComfyUI-bitpoet-IG4Inpaint"), or the old-fashioned way:
cd ComfyUI/custom_nodes
git clone https://github.com/BitPoet/ComfyUI-bitpoet-IG4Inpaint
Restart ComfyUI. The pack has no requirements.txt, no model files, and no other dependencies - it's pure Python, so this node works even if you never touch the Ideogram 4 stuff it ships alongside. You'll find it under the BitPoet/helpers category in the node menu.
Gotchas
The only real footgun is base = 0, which raises a ValueError ("base must not be 0") - division by zero, obviously. The UI lets you drag it there, so don't. Everything else is predictable, which is the point of a node like this.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| width | [object Object] | — | |
| height | [object Object] | — | |
| baseopt | [object Object] | — | |
| upopt | [object Object] | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |