Round To Even
Because diffusion models are allergic to odd numbers
- INT
Round To Even takes an integer and hands back the nearest even number. One INT in, one INT out, and the whole thing is a single line of math: 2 * round(value / 2). You'd be forgiven for thinking that's too trivial to ship, right up until a video node refuses your width because it's odd.
Diffusion models are picky about integer constraints in a way that makes no sense until you've hit it. SDXL and Flux want dimensions that come out clean in multiples of 64; LTX requires width and height divisible by 32 and frame counts divisible by 8 plus 1; and a whole layer of custom video nodes will silently break, or produce tiling and artifacts, on an odd number. When you compute a size on the fly - from a math node, a FLOAT→INT conversion, or a divisor that leaves a remainder - odd values are the default, not the exception. Round To Even is the guard you drop in front of any node that insists on evenness.
The inputs and outputs
Only one widget: value, an integer with a default of 1, range 2 to 999999. Output is the nearest even INT. One quirk worth knowing: the widget minimum is 2, so you can't round anything below 2 through the UI. That's harmless - 0 is the only even number you're missing, and neither 0 nor negatives are useful dimensions.
Where it slots in
The pattern that actually matters: you compute a target width or frame count from something else, round it, and feed the result to a sampler, a size node, or a video encode. Say you're scaling a clip to fit a frame budget - divide, convert to int, get 1023, and the video node chokes. Round To Even makes it 1024 and the pipeline runs. It's the same convention this pack's Input Switch uses internally (that node rounds its own caps down to even before resizing), so the two are philosophically aligned - even if they never need to meet in the same workflow.
Honest take: this is a two-line utility, and you shouldn't install the pack for it alone. bmgjet/comfyui-inputswitch is a grab-bag - RIFE frame interpolation, InsightFace face swap, color matching, and math nodes - and it carries heavy dependencies with it: a pinned torch==2.9.1, kornia, onnxruntime-gpu, and OS-specific insightface and numpy wheels, all auto-installed on first load. If all you want is even rounding, ComfyUI's built-in math or a simple Primitive-based computation gets you there with zero extra weight. But if the pack is already in your install because you use its video or face-swap nodes, this is a nice freebie to have in the palette - it's one click to add and it removes a whole class of "why does my video look broken" surprises.
Installing it
Standard for this pack: ComfyUI Manager (search comfyui-inputswitch) or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmgjet/comfyui-inputswitch.git
Then restart after the first load so the one-time dependency install can finish. If you're on Python 3.12 with CUDA, you're in the sweet spot the README targets; anything else may hit the version-specific wheel dance.
Troubleshooting
- Value clamps to 2: that's the widget minimum talking. If you genuinely need to round 0 or a negative, do it in a math node instead - this one won't let you.
- Output looks like the input: because the input was already even. Not a bug; there's nothing to round.
- Still getting dimension errors downstream: check whether the node needs a multiple of 32 or 64, not just even. Round To Even gets you even - it won't get you to the next multiple of 64. Set your computed value close to the target before rounding and you'll land where you want.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | INT | 12–999999 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |