Image Padding Advanced
Grow-only padding with three edge strategies (and a silent trap)
- image
- image
Sometimes the fix for a too-small image isn't resizing it - it's giving it a frame. That's Image Padding Advanced: it pads an image up to a target width and height, center-weighted, with three different ways of filling the new edges. It's the "grow" half of a canvas-prep kit, and if you've ever fought a ControlNet condition that had to exactly match a canvas, or wanted a batch of different-sized images to share one resolution without stretching them, this is the node you were looking for.
What it does
Give it an image, a target width and height (both default to 64, range up to 2048, stepped by 16), and a method. It centers the original image in the new canvas and fills the borders with:
- constant - solid black padding (value 0). Clean, predictable, the standard for outpainting and inpainting canvases.
- replicate - extends the edge pixels outward. Keeps the frame feeling like the image's own border; good for texture continuity.
- reflect - mirrors the edge content. The smoothest-looking padding, great for seamless-ish tiles, slightly weird on busy images.
You get the padded image back, same channel layout, ready to feed downstream.
The trap
This node is grow-only. If a target dimension is smaller than the original, it silently pads nothing on that axis - and if both dimensions are smaller, it returns your image completely unchanged, no warning. The code only pads when target > original. So if your "pad to 1024" gave you back an 800px image with no explanation, that's why. When you're building a fixed-size canvas, either ensure the target is always larger than the source, or run Image to Multiple of / a resize first and pad afterward.
Also note the padding is computed per side with integer halving, so on odd gaps the extra pixel lands on the right/bottom. Doesn't matter in practice, but it's there.
Install
It's part of ComfyUI-GlifNodes, the pack from the glif.app team. ComfyUI Manager → "ComfyUI-GlifNodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/glifxyz/ComfyUI-GlifNodes
Restart ComfyUI. No model downloads, no CUDA requirement - it's pure tensor padding, instant. Fun fact: the pack README still doesn't list this node or its test file, so if you're reading docs that look out of date, you're not going crazy; the code is newer than the README.
Where it shines: prepping img2img / ControlNet conditions to an exact canvas size, standardizing a batch of images to one resolution before a batch sampler, and building outpainting canvases. Just remember the grow-only rule and it'll never surprise you again.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width | INT | 641–2048 | — |
| height | INT | 641–2048 | — |
| method | COMBO | 3 options: constant, replicate, reflect |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |