Pad Image For Outpainting (Color)
Same Outpainting Pad Node, Except the Fill Color Is Yours
- image
- IMAGE
- MASK
If you've ever wondered why the new canvas in an outpainting workflow is always flat grey, this node is the answer: it's ComfyUI's built-in Pad Image For Outpainting, with one change - the padding is filled with a color you pick. It sounds cosmetic. It isn't.
The fill is conditioning. People pad the canvas and then prompt "outpaint the image filling the grey areas", because the grey is what the model sees - and when they drop denoise to protect the composition, the grey comes back:
"lowering the denoise results in a plain grey background where it should be outpainting, every single time." (r/StableDiffusion, thread
1awfolc)
Match the fill to what should be there - sky blue up top, wall beige on the side - and a low-denoise pass has something to converge toward. The manual version of this has been standard advice for years:
"I always get better outpainting results if I initialize the area to be outpainted with something. I usually use GIMP to smudge patches of color from the original image that roughly indicate what I want, then outpaint with reduced denoising." (thread
1ml5zou)
This node is that trick without the round trip through GIMP.
How it works
Pure PyTorch, no model calls, no network, no dependencies. It allocates a canvas of h + top + bottom by w + left + right, fills it with your color, and copies the original in pixel for pixel at the offset. Nothing is resized or re-encoded - only the border is new.
Then it builds a MASK: 1 over the new area, 0 over the original, with a quadratic falloff (feathering) applied inward from the original's edges - but only on sides you actually padded. Two details that bite: feathering silently doesn't apply unless feathering * 2 is smaller than both the image height and width, and four-channel inputs get fully opaque alpha in the padded area. A bad hex value doesn't crash anything - it falls back to #808080 and the node labels it red in the UI.
The fields that matter
- image - your source; batches preserved.
- left / top / right / bottom - pixels to add per side, in steps of 8, matching the VAE's 8× downscale so you can't type a size the sampler dislikes. Pad freely, but 1024×1024 plus 256 a side is 1536×1536 - resize before sampling or expect a slow, mushy pass.
- feathering - 40 by default, and the one parameter that decides whether the seam disappears. It's the mask blur, built in rather than bolted on with a separate blur node.
- color - hex, default
#808080(the original node's neutral grey), with a native picker synced to a live hex field.#F80shorthand works too.
Outputs: IMAGE and MASK. The image goes into VAE Encode, or into InpaintModelConditioning on a Flux Fill / edit-model stack; the mask goes into SetLatentNoiseMask, that same conditioning node, or ImageCompositeMasked to paste back afterwards. Inpaint Crop and Stitch takes both.
There's a 2026 use for the color field too: the current cheap outpainting trick is to pad with a loud color and prompt the model to delete it - 200px of red a side, then "remove the red padding and show what's behind it". That's a knob the built-in node doesn't have.
Install
There's nothing to download - dependencies = [] in the pack metadata, no requirements.txt, just torch, which ComfyUI already has:
cd ComfyUI/custom_nodes
git clone https://github.com/Slartibart23/ComfyUI-PadImageForOutpaintingColor-v1.0.0
Restart ComfyUI, then hard-refresh the browser (Ctrl+F5). The README insists on it and it matters: the picker is a frontend extension served from the pack's web/ folder, so a cached frontend gives you a bare hex text field and no picker, which looks like a broken install. Via Manager it's on the Comfy registry as publisher slartibart23b - search "Pad Image For Outpainting (Color)", or use Install via Git URL as the author documents. The node shows up under image. Note the pack folder keeps a literal -v1.0.0 suffix, unlike everything else in custom_nodes, so it's easy to miss when scanning the directory.
Common issues
No color picker. Hard-refresh. If it's still missing, check the console on startup - the hex field works either way.
The output is grey even though I picked orange. The pad is a hint, not a promise. At high denoise the model repaints the area and can ignore both the fill and your prompt; if the color survives a low-denoise pass, nudge denoise up or move the fill closer to the real content color.
Hard seam at the border. Turn feathering up so the mask overlaps 20–30% of the original's edge, and composite afterwards - every VAE round trip costs you the original's detail.
Everything went dark and grainy. That's the outpainting model, not this node; Flux Fill draws this complaint on large extensions (thread 1ml5zou). More surrounding context, a smaller first step, or Alimama's inpainting ControlNet are the fixes people report working.
Worth being honest about what this is: a one-node, ~60-line pack from an author with no other footprint in the community. That's fine, because there's no machinery to audit - read __init__.py and you've read all of it. KJNodes' ImagePadKJ and WAS Node Suite do padding with more knobs, but neither is a two-widget drop-in for the node already sitting in your workflow.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| left | INT | 00–16384 | — |
| top | INT | 00–16384 | — |
| right | INT | 00–16384 | — |
| bottom | INT | 00–16384 | — |
| feathering | INT | 400–16384 | — |
| color | STRING | #808080 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |