Round Image (Pad/Crop) (Advanced)
Round Image (Advanced)
- images
- images
- crop_left
- crop_right
- crop_bottom
- crop_top
Round Image (Advanced) is the plain Round Image (Pad/Crop) node with two upgrades bolted on: every rounding parameter gets an _override input you can drive from another node, and it hands you back the exact crop amounts it just applied. If the base node is "make the numbers work," this one is "make the numbers work and tell me what you did" - which is what you want the moment your workflow needs to undo the operation.
The flagship use is the pad-and-recover round trip. You round an image up to a multiple with padding, run your resolution-sensitive step (sampling, inpainting, whatever demanded the size), then crop the padding back off to restore the original canvas. The plain node can't do that cleanly because it never reports where the padding went. This one outputs crop_left, crop_right, crop_bottom, and crop_top - the exact pixel counts to slice back off - designed to feed straight into this same pack's Crop Image (Advanced) node.
How it works
Same core math as the base node: it rounds each dimension to the nearest multiple of nearest_x / nearest_y, padding or cropping the difference, with split_x / split_y deciding which side the change lands on and pad_value filling any padding.
What's new is the plumbing. The optional inputs (nearest_x_override, nearest_y_override, split_x_override, split_y_override, pad_value_override) are forced-input connections - when you wire something into one, it replaces the widget value for that run. That lets another node compute the multiple or the split dynamically instead of you hand-tuning widgets. Leave them unplugged and the plain widgets win, exactly like the base node.
Inputs and outputs
images,round_type(Pad/Crop),nearest_x,nearest_y,split_x,split_y,pad_value- identical to the base node.- The five
_overrideoptional inputs listed above. - Outputs:
images, pluscrop_left,crop_right,crop_bottom,crop_top- four INTs.
Those four INT outputs are the point. Wire them into Crop Image (Advanced), which lives in the same pack and exists for exactly this pairing: it takes the four crop amounts and slices them off the image, giving you back your original dimensions after the padding did its job.
Installing it
Same pack as everything else here - comfyui-image-round by cdb-boop, a small pure-PyTorch pack with no dependencies and no model downloads. It's not in the official Comfy registry yet, so Manager search may not find it; clone it directly:
cd ComfyUI/custom_nodes
git clone https://github.com/cdb-boop/comfyui-image-round
Restart ComfyUI and all four nodes in the pack appear under the "image" category. Or use Manager's "Install via Git URL" with https://github.com/cdb-boop/comfyui-image-round.
Gotchas
- The default pad color is white. In the pad-then-recover pattern that's harmless (you crop it off anyway), but if you're sampling on the padded image, white gutters can bleed into the edges. Drop
pad_valueto 0 for black. - The crop outputs are what you'd expect, not a surprise.
crop_left/crop_rightsum to the horizontal delta andcrop_bottom/crop_topto the vertical - withsplitat 0.5 they split evenly, which is the friendliest default for the round trip. - Don't chain the overrides recursively. If you wire the crop outputs back into the overrides you'll build a loop that rounds and re-rounds. Compute once, consume once.
If you only need a size that divides evenly, save yourself the wiring and use the plain Round Image node. Reach for the Advanced version when you need to restore the original canvas afterward - that's its whole reason to exist, and it's the best little workflow this pack ships.
Inputs (12)
| 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 | — |
| nearest_x_overrideopt | INT | 11–18446744073709550000 | — |
| nearest_y_overrideopt | INT | 11–18446744073709550000 | — |
| split_x_overrideopt | FLOAT | 0.000–1 | — |
| split_y_overrideopt | FLOAT | 0.000–1 | — |
| pad_value_overrideopt | FLOAT | 1.000–1 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| crop_left | INT | — |
| crop_right | INT | — |
| crop_bottom | INT | — |
| crop_top | INT | — |