Nodes/ComfyUI-Addoor/AD Advanced Padding
ComfyUI Node

AD Advanced Padding

Scale, pad, and get an outpaint mask in one node

By Eagle-CN·Created 2 years ago·Updated about a year ago· 75
AD Advanced Padding
  • image
  • background
  • image
  • mask
scale_by1.00
upscale_methodlanczos
left0
top0
right0
bottom0
color#ffffff
transparentfalse

Adds a border around an image - on each side independently - and, crucially, hands you back a mask marking exactly the area you added. That mask is the reason to care: it's the setup for outpainting. Pad the canvas, feed the mask to an inpaint model, and it fills the new space to match. It'll also just add plain borders if that's all you want.

Where it fits

Outpainting - extending an image beyond its original frame - needs two things: a bigger canvas with empty space, and a mask telling the sampler which part is empty. Doing that by hand with pad and mask-creation nodes is fiddly. Advanced Padding does both in one shot: you say how many pixels to add on the left, top, right, and bottom, and it returns the enlarged image plus a matching mask. Wire that pair into an inpainting workflow and you've got a clean outpaint. If you just need a matte or a border for presentation, ignore the mask and take the image.

How it works

First it can scale the whole image by scale_by (using upscale_method as the resampling filter), then it pads out by the per-side pixel amounts, filling the added region with a solid color - or leaving it transparent if you flip that on. There's also an optional background image input: instead of a flat fill, the padding is composited over whatever background you feed it.

The inputs that matter

  • left / top / right / bottom - how many pixels to add on each side, independently. This is the core of it.
  • color - the fill color for the border, as a hex string (default white). Ignored if transparent is on.
  • transparent - make the padded area transparent instead of a solid color. Useful when you'll composite later.
  • scale_by - optionally resize the source before padding; leave at 1 if you only want to pad.

Two outputs: image, the padded result, and mask, marking the added region. For outpainting, both go downstream - image to the latent/inpaint path, mask to tell the sampler what to generate.

Common issues

The most common confusion is expecting the model to fill the padding on its own - this node only creates the space and the mask. The actual outpainting happens in whatever inpaint sampler you wire the mask into; Advanced Padding is the prep step, not the generator. If your outpaint has a hard seam, that's usually the inpaint model's denoise or the mask edge, not this node. And if you set transparent but then a downstream node flattens to RGB, the transparency is lost - keep the alpha alive through the chain, or use background to composite directly.

Installing ComfyUI-Addoor

ComfyUI-Addoor (葵花宝典) is a utility and image-plumbing pack from developer Eagle-CN. ComfyUI Manager: Install Custom Nodes → search "ComfyUI-Addoor" → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/Eagle-CN/ComfyUI-Addoor.git
cd ComfyUI-Addoor
pip install -r requirements.txt

Restart and find it under 🌻 Addoor / image.

Category🌻 Addoor/image

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
scale_byFLOAT1.000.1–8
upscale_methodCOMBOlanczos4 options: nearest-exact, bilinear, bicubic, lanczos
leftINT00–4096
topINT00–4096
rightINT00–4096
bottomINT00–4096
colorSTRING#ffffff
transparentBOOLEANfalse
backgroundoptIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK