PVL Padding
Add white space to an image, one side at a time
- image
- IMAGE
PVL Padding does one thing and does it without ceremony: it grows an image by adding a solid-color border around it, with independent control over each side. Left, right, top and bottom paddings are separate numbers, the fill color is three RGB sliders (default white), and it all comes back out as a single IMAGE.
It's from pvlprk/comfyui-pvl-api-nodes ("ComfyUI Assistant Node"), and it's the manual version of a problem the pack's Image Resize node solves automatically. If you know the exact padding you want, this is the one.
How it works
The implementation is straightforward tensor math. The image is converted to RGBA internally, a colored canvas is built at the new dimensions (old size + padding on each side), and the original is dropped into place. Two details worth knowing:
- The color is solid. No gradients, no blurred edges - the padding region is a flat RGB fill.
include_alphatoggles whether the output keeps an alpha channel. On (default off), the output is RGBA; off, it collapses back to RGB. Leave it off unless you're compositing, because a lot of downstream nodes quietly drop the alpha anyway.
Inputs that matter
image- theIMAGEinput.padding_left/padding_right/padding_top/padding_bottom- fourINTs, each up to 4096, default 0. Zero a side and it just isn't padded.red/green/blue- the fill color, 0–255 each, default white (255,255,255). There's no alpha slider; transparency isn't part of the fill.include_alpha- keep RGBA in the output (see above).
Output: one IMAGE at (H + top + bottom) × (W + left + right).
When you'd actually use it
Three recurring situations. First, aspect-ratio fixing without resampling: pad a 512×512 up to 512×768 by adding bottom padding, and nothing gets distorted - the subject is untouched, which matters when you don't want a resize to soften it. Second, pre-stitching: when you're about to lay images into a grid (the pack's PVL Stitch 2 Size does grids automatically), padding individual tiles first keeps gaps and alignment consistent. Third, frame generation: adding a border before feeding an outpainting or inpainting chain gives the model context to extend into.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/pvlprk/comfyui-pvl-api-nodes
restart, or use ComfyUI Manager and search for "ComfyUI Assistant Node". No model downloads; torch and numpy, which ComfyUI already has, are all this node touches.
Where it trips people up
- It's manual by design. If your goal is "pad to exactly 1024×1024" and you don't want to compute the margins yourself, reach for Image Resize's
padmode instead - it does the math and centers the result. This node is for when you want specific, asymmetric padding. - Alpha fill is not a thing. If you need transparent padding, Image Resize's
pad_coloraccepts RGBA strings like255, 255, 255, 0; this node does not. - The color is opaque white by default. If you pad and the result looks like it has a hard white frame where you expected black, check the RGB sliders - that's the whole story.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| padding_left | INT | 00–4096 | — |
| padding_right | INT | 00–4096 | — |
| padding_top | INT | 00–4096 | — |
| padding_bottom | INT | 00–4096 | — |
| red | INT | 2550–255 | — |
| green | INT | 2550–255 | — |
| blue | INT | 2550–255 | — |
| include_alpha | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |