ComfyUI Node

PVL Padding

Add white space to an image, one side at a time

By pvlprk·Created about a year ago·Updated 8 months ago· 1
PVL Padding
  • image
  • IMAGE
padding_left0
padding_right0
padding_top0
padding_bottom0
red255
green255
blue255
include_alphafalse

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_alpha toggles 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 - the IMAGE input.
  • padding_left / padding_right / padding_top / padding_bottom - four INTs, 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 pad mode 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_color accepts RGBA strings like 255, 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.
CategoryPVL/utility

Inputs (9)

NameTypeDefaultDescription
imageIMAGE
padding_leftINT00–4096
padding_rightINT00–4096
padding_topINT00–4096
padding_bottomINT00–4096
redINT2550–255
greenINT2550–255
blueINT2550–255
include_alphaBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE