Nodes/fexli-util-node-comfyui/FEImagePadForOutpaint
ComfyUI Node

FEImagePadForOutpaint

The node that makes outpainting actually work

By fexli·Created 3 years ago·Updated about a year ago· 3
FEImagePadForOutpaint
  • image
  • pad_color
  • IMAGE
  • MASK
left0
top0
right0
bottom0
feathering50

Outpainting has a boring prerequisite that most tutorials skip: before the sampler can extend your image, something has to grow the canvas. You need a bigger image with your original sitting in the middle and the surrounding area filled with something. That's the entire job of FEImagePadForOutpaint - and it does it properly, which is rarer than it should be.

It's the node I'd reach for over the built-in Pad Image for Outpaint when I want control over the pad color and a feathering mask in one go, because it hands you both the padded image and the mask you'll feed into the sampler. That mask is what tells the model "regenerate everything except the original pixels."

How it works

You give it your image and four padding values - left, top, right, bottom, each 0–8192 in steps of 8 (so they stay friendly to latent sizes). It builds a new canvas filled with pad_color (default black), drops your original image at the offset, and produces a MASK where the original region is 0 and the pad area is 1.

Where it gets clever is feathering. Instead of a hard binary mask, it computes a squared falloff around the inner image's border - the mask ramps smoothly from 1 at the outer edge of the pad down to 0 at the original. That soft edge is what stops your outpaint from showing a visible square seam where generated content meets source pixels. If feathering is 0, or larger than half your image's width/height, it falls back to a hard mask.

The pad_color input accepts an RGB color, and it can carry an s seed field (which FERandomizedColorOut in the same pack exploits) so you can randomize the pad tint per run and still keep it reproducible.

The inputs that matter

  • left / top / right / bottom - how much canvas to add on each side. In steps of 8 to keep dimensions divisible for the VAE.
  • feathering - the blend width of the mask edge, default 50. Crank it up for seamless composition, keep it low if you want a sharper boundary.
  • pad_color - the fill. Black works; a color pulled from the image's edge usually blends better.

Outputs are IMAGE (padded) and MASK. Wire the mask into the mask input of a KSampler or an inpainting workflow, keep the pad area at high denoise and the inner region masked out - the standard recipe from the KB's inpainting essay, and it still holds.

Troubleshooting

  • Obvious seams: your feathering is too low, or you're denoising the whole padded image instead of letting the mask protect the center.
  • Dimensions not matching the model: remember the 8-step. If your total ends at, say, 1022, the sampler may complain.
  • Wrong pad color: a pure black surround can tint the generated sky or wall. Feed a color sampled from the image edge.

Install

It's part of fexli-util-node-comfyui:

cd ComfyUI/custom_nodes
git clone https://github.com/fexli/fexli-util-node-comfyui
cd fexli-util-node-comfyui
pip install -r requirements.txt

Or in ComfyUI Manager, search fexli-util-node-comfyui and install. Dependencies are light (pycryptodome, sseclient-py); the README's config.yaml step is only for the pack's API nodes, not this one.

One honest caveat: outpainting as a technique has been partially displaced by instruction-edit models like Flux Kontext and Qwen-Image-Edit, which extend images from a sentence. But if you want bit-identical pixels where the original sits - no edit model offers that - this node is exactly the right tool, and it's still the standard move for the uncensored SDXL/Illustrious stack.

Categoryfexli/image

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
leftINT00–8192
topINT00–8192
rightINT00–8192
bottomINT00–8192
featheringINT500–8192
pad_colorRGB_COLOR[object Object]

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK