Image Pad
Add a border of any color, for outpainting or just breathing room
- image
- image
Padding is the quiet workhorse of image processing. You need a border around a subject for outpainting. You need margins so a generation has room to breathe. You need to grow an image to a size your upscaler or VAE is happy with. Image Pad is that tool: it takes an image and adds left, right, top, and bottom pixels of a color you choose, with an image tensor out the other end.
The mechanism is as direct as it gets - the source allocates a new tensor at the padded size, fills it with your chosen background color, and drops the original image into the offset region. Where the node shows its hand is the color field: it's a plain string, and the parser is friendlier than you'd expect. "0, 0, 0" (the default) is black. You can write "255, 255, 255", give it hex like #ffffff, or just use a name - white, black, red, green, blue, gray/grey are all recognized. Anything it can't parse quietly becomes black, which is the one surprise worth knowing.
Each side's padding is a separate integer, so you can pad asymmetrically - 64px left, 0 right - which is exactly what you want when you're extending an image in one direction for an outpaint. Max is 4096px per side, which is plenty for practical work.
Inputs and outputs that matter
- image (in) - the image to pad.
- left / right / top / bottom (in) - pixels added on each side, default 0 each.
- color (in) - the border color as a string: "r, g, b", hex, or a color name. Default "0, 0, 0".
- image (out) - the padded image, larger by the sums you set.
Installing it
Part of wenchengxiang/ComfyUI-Practical-Tools. ComfyUI Manager → Custom Nodes Manager → search "ComfyUI-Practical-Tools" → Install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/wenchengxiang/ComfyUI-Practical-Tools
then restart. No pip dependencies, no model downloads - pure Python on ComfyUI's bundled stack.
Issues and gotchas
The main footgun is the color string: an empty box defaults to black, and a typo like "wite" also lands on black - so if your border suddenly looks charcoal instead of white, check the spelling, not your monitor. Note the padding is strictly additive; it won't resize to a target size on its own, so to hit an exact final dimension you compute the four offsets by hand. And padding pushes the original content into the top-left of the result - there's no "pad and center" option here. If your goal is a centered canvas or a specific final size, do the math in the four boxes.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| left | INT | 00–4096 | — |
| right | INT | 00–4096 | — |
| top | INT | 00–4096 | — |
| bottom | INT | 00–4096 | — |
| color | STRING | 0, 0, 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |