Round Image (Pad/Crop)
Your image is 521x521 and the model hates it — round it to a multiple
- images
- images
Somewhere in your workflow an image has to be a specific size. SD 1.5 wants 512, SDXL has its handful of trained aspect ratios, Flux wants everything divisible by 64, and video models straight-up refuse resolutions that aren't divisible by 8 or 32 - people hit this constantly in r/comfyui. The lazy fix is "resize it," which distorts or destroys your composition. Round Image (Pad/Crop) does the honest version: it pads your image up to the nearest multiple, or crops down to it, without stretching a single pixel.
That's the whole pitch. Feed it any image, tell it "nearest multiple of 8" and whether to pad or crop, and out comes an image whose dimensions actually divide by 8. If you're doing img2img, inpainting, or feeding a source image into a resolution-sensitive model, this is the box that ends the "size mismatch" errors without re-inventing your composition.
How it works
The math is the good kind of simple. For each axis it rounds the dimension to the nearest multiple of your nearest_x / nearest_y - up if you're padding, down if you're cropping - then pads or slices the difference. It's pure PyTorch tensor work, no model, no downloads, runs in milliseconds.
Two knobs decide where the change happens:
split_x/split_y(0–1, default 0) split the padding (or cropping) between sides. 0 puts it all on the right/top, 1 puts it all on the left/bottom, 0.5 splits evenly.pad_value(0–1, default 1) is the fill color of the padded area - 1 is white, 0 is black. Only matters in Pad mode.
Inputs and outputs
images- the IMAGE you want fixed.round_type- "Pad" or "Crop". Pad rounds up and adds pixels, Crop rounds down and removes them.nearest_x,nearest_y- the multiples. 8 covers most latent requirements; 64 for Flux. Leave at 1 to skip that axis.split_x,split_y,pad_value- the two positioning knobs and the fill color above.
One output, images, ready to feed into your sampler, upscaler, or whatever demanded the multiple.
The two inputs that actually matter 90% of the time are round_type and nearest_x/nearest_y. Split and pad value are there for when you care where the fat edge lands - which you do if you're compositing.
Installing it
This node ships in comfyui-image-round by cdb-boop. It's a small, zero-dependency pack - pure PyTorch, no requirements beyond what ComfyUI already installs, no model files. It's not in the official Comfy registry yet, so Manager search may not surface it; use the direct route:
cd ComfyUI/custom_nodes
git clone https://github.com/cdb-boop/comfyui-image-round
Restart ComfyUI and it's under the "image" category. In Manager, "Install via Git URL" with that same URL also works.
Gotchas
- The pad color is white by default. If you're padding a dark image and compositing the result, a white gutter will show. Set
pad_valueto 0 for black, or pick the split so the pad lands on the edge you'll trim later. - Check which axis actually needs rounding. A 1024x1001 image only trips the vertical requirement; no point disturbing the width. Leave
nearest_xat 1 if the width is already fine. - Crop mode throws away pixels. Fine for hitting a size requirement, terrible if you then try to restore the full image - that's what the advanced variant and its companion crop node are for.
- It doesn't change aspect ratio on its own; it only rounds dimensions. That's a feature, not a bug.
If all you need is "make this image a size the model accepts," this is the one to reach for. It won't upscale, it won't hallucinate detail - it just makes the numbers work, which is usually all the error message was asking for.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| round_type | COMBO | Pad | 2 options: Pad, Crop |
| nearest_x | INT | 11–18446744073709550000 | — |
| nearest_y | INT | 11–18446744073709550000 | — |
| split_x | FLOAT | 0.000–1 | — |
| split_y | FLOAT | 0.000–1 | — |
| pad_value | FLOAT | 1.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |