Image Pad For Outpaint Masked (UTK)
The outpaint prep node that gives you the mask too, so you don't regenerate the old pixels
- image
- mask
- IMAGE
- MASK
Outpainting has a classic failure mode: you pad the canvas, run the sampler at full denoise, and the model cheerfully redraws your original content along with the new area. The fix has always been a mask that protects the old pixels and only lets the sampler touch the newly padded region. Image Pad For Outpaint Masked (UTK) hands you both halves in one go - the padded image and the mask that says exactly where the new canvas is - which is why it beats padding by hand.
It's part of ComfyUI-UniversalToolkit and it's basically the "padded-canvas-for-outpainting" utility done properly. The thing that separates it from a dumb Pad Image node is that mask output.
How it works
You give it your image and the amount of padding on each side. data_mode chooses the units: pixel for literal pixels, percent for a percentage of the image's dimension on that side. Then it builds a new canvas filled with background_color (gray by default - gray is the standard outpaint fill because the sampler treats it as neutral unknown territory) and places your image in it, offset by the padding.
The mask side is where the smarts live. It produces a mask that's white across the new padded area and black over your original image - so you can feed it straight into a masked sampler and guarantee the original pixels aren't regenerated. feathering ramps the mask edge from 0 to full over that many pixels, which softens the seam between old and new content and hides the boundary. There's also an optional mask input: pass in your own existing mask and it gets padded in lockstep, inverted as needed, so your subject's protective mask scales correctly with the canvas.
Inputs and outputs that matter
data_mode-pixelorpercent.left/top/right/bottom- padding per side (0–1000).feathering- soft edge width in pixels (0–8192).background_color- the fill; gray default.image+ optionalmask.
Outputs: IMAGE (the padded canvas) and MASK (the outpaint region). The mask wires into your sampler's denoise_mask input - the whole point.
Install and gotchas
Install via ComfyUI Manager (search "ComfyUI-UniversalToolkit") or:
cd ComfyUI/custom_nodes
git clone https://github.com/whmc76/ComfyUI-UniversalToolkit
pip install -r requirements.txt
Restart ComfyUI. No models, no keys.
Where people get burned: forgetting that the output mask is inverted relative to the usual inpainting convention - white is the area to regenerate, black is protected. If your sampler ends up repainting your original image, that's the first thing to check. Also, the mask treats a fully black incoming mask as "no mask" (it prints a warning), which is convenient but can surprise you if you genuinely wanted an all-black protective mask. And on the workflow side, remember that a padded canvas changes your latent dimensions - make sure your VAE-encode and sampler operate on the padded size, not the original.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| data_mode | COMBO | pixel | 2 options: pixel, percent |
| left | INT | 00–1000 | — |
| top | INT | 00–1000 | — |
| right | INT | 00–1000 | — |
| bottom | INT | 00–1000 | — |
| feathering | INT | 00–8192 | — |
| background_color | COMBO | gray | 9 options: gray, white, black, red, green, blue, +3 |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |