🖼️ Image Pad Color
Add a solid-color frame without breaking your aspect ratio
- image
- color
- image
- width
- height
There are two reasons to add pixels around an image, and they look similar but are different jobs. One is a border - a presentation frame around a finished image. The other is padding to a canvas - growing the image to a target aspect ratio or resolution without stretching the content, so a 4:3 render can sit centered on a 16:9 canvas and then be processed as 16:9. 🖼️ Image Pad Color does both, with control over each side and a color of your choice.
The inputs
image- the source. The four sides are independent:top,bottom,left,right, each in pixels (0–8192). Want a letterbox instead of a symmetric frame? Settop/bottomto whatever you need and leave the sides at 0.color- a hex color picker, default#000000(black). If you're padding for a specific background - say matching a brand color so the border blends into a webpage - pick the hex here. The node parses the#RRGGBBvalue directly.
The outputs are the padded image, plus width and height as INTs - the final dimensions, which you can wire into downstream nodes that need to know the canvas size. That's the sleeper feature: pad, then feed the new width/height into whatever node does the next step, and everything stays consistent.
Where it fits
The most useful pattern in a ComfyUI context is canvas padding before a second pass. Generate a 1:1 square, pad it to 16:9 with a solid color (or a pad-and-crop trick), and run img2img on the padded canvas - the model sees the full frame you actually want. It's also the standard tool for generating a specific output size from a model that produced a different one, and it pairs with the pack's Divisible Crop: crop to a valid stride, then pad to a target dimension. Border frames for presentation are a nice secondary use.
Installing it
Comes with the Louis Use pack:
cd ComfyUI/custom_nodes
git clone https://github.com/LouisLU1997/ComfyUI-louis-use Louis_use
Or "Louis Use" in ComfyUI Manager, then restart. Pure PIL/torch, no extra dependencies.
What to watch
- Padding is solid color, not mirrored or blurred. If you want a seamless out-fill for img2img (the "make the canvas bigger and let the model fill it" trick), a solid pad will be visible as a hard edge unless you run an inpainting pass over the padded region. This node is the canvas builder, not the content filler.
- Four separate controls, not a single border size. If you expected one "border" slider, the per-side controls are more flexible but also more to set. For a uniform frame, type the same number four times.
It's a simple, honest utility. When your output resolution needs to be something specific and the image isn't, it's the fastest way there without resampling the pixels.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| top | INT | 2000–8192 | 顶部扩展像素数 |
| bottom | INT | 2000–8192 | 底部扩展像素数 |
| left | INT | 2000–8192 | 左侧扩展像素数 |
| right | INT | 2000–8192 | 右侧扩展像素数 |
| color | COLOR | #000000 | 扩展区域填充色,默认黑色 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |