Nodes/KJNodes for ComfyUI/Image Pad For Outpaint Masked
ComfyUI Node Runs on cloud

Image Pad For Outpaint Masked

Extend a canvas without touching your original pixels

By kijai·Created 3 years ago·Updated about 21 hours ago· 2,930
Image Pad For Outpaint Masked
  • image
  • mask
  • IMAGE
  • MASK
left0
top0
right0
bottom0
feathering0

Outpainting - extending an image past its original edges - is conceptually just inpainting where the mask covers the new empty space instead of an existing region. There's a newer trick going around for doing this with instruction-editing models like Flux Klein (pad the canvas with a solid color, prompt the model to remove it), but the older, more controlled masked route still wins when the original pixels genuinely have to survive untouched, or when you're extending the same image multiple times and can't afford drift accumulating with each pass. ImagePadForOutpaintMasked is KJNodes' version of that first step: pad the canvas in whichever directions you need, and get back both the padded image and a properly generated mask for it - with the option to combine an existing mask into the extension rather than starting from a blank one.

How it works

You specify how many pixels to add on each side; the node places your original image on a larger canvas and generates a mask covering the new blank area (so a sampler knows exactly what to fill in and what to leave alone). If you pass in an existing mask, it gets folded into that generated mask rather than discarded - useful if you're also touching up part of the original image at the same time as extending it. feathering softens the seam between original and new content, the same purpose mask blur serves in ordinary inpainting.

The inputs and outputs that matter

  • image - the image you're extending.
  • left, top, right, bottom (all default 0, up to 16384, step 8) - how many pixels to add on each side. Leave any side at 0 to skip extending that direction; the step of 8 keeps you aligned to values most VAEs and samplers expect.
  • feathering (default 0, up to 16384) - how much the mask edge is softened. A typical starting range for this kind of seam-blending is roughly 4–12 pixels; too little leaves a visible hard edge, too much bleeds the effect into the original image.
  • mask (optional) - an existing mask to combine with the auto-generated outpaint mask.

Two outputs: IMAGE, the padded canvas with your original content placed on it, and MASK, marking the new area (plus whatever you passed in via the optional mask) ready for your sampler.

How to install it

Via ComfyUI Manager: search "KJNodes for ComfyUI," install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt

then restart. No extra dependencies - plain canvas and mask generation.

Common issues & troubleshooting

Visible seam where the original meets the new content. Raise feathering - a hard edge with 0 feathering is the most common cause of an obviously "pasted on" outpaint result. The community's general advice for outpainting seams applies here too: generous mask coverage plus real feathering, not a hard cutoff.

The extension looks flat or disconnected from the original. This node only pads the canvas and builds the mask - the actual generation quality depends entirely on your sampler settings after this node. Outpainting typically needs a high denoising strength (0.8–1.0) in the new region, since it's meant to be substantially new content, not a subtle touch-up.

You padded but nothing changed after sampling. Double check the mask is actually reaching your sampler - if a step downstream expects the mask on a different input, or you accidentally used the original unmasked image instead of this node's IMAGE output, the sampler has nothing telling it where to generate.

Categoryimage

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
leftINT00–16384
topINT00–16384
rightINT00–16384
bottomINT00–16384
featheringINT00–16384
maskoptMASK

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK