Pad Image for Outpainting MXD
Grow your canvas for outpainting — with the mask built in
- image
- IMAGE
- MASK
Outpainting is just inpainting with extra steps: you enlarge the canvas, then ask the model to fill the empty space around your original image. The fiddly part is the setup - you need the image padded out, and you need a mask that says "everything except my original content is new." Pad Image for Outpainting MXD does both in one node: it pads your image with neutral grey, rounds the result to a friendly resolution, and hands you the matching MASK so the empty border is exactly what gets regenerated.
Why the padding details matter
Two things trip people up when they hand-build this. First, models like clean multiples - Flux, SDXL, and friends all behave better when the canvas lands on a nice number, which is why the node has a round_to dropdown (None / 2 / 8 / 16 / 32 / 64, default 16). Second, a correct mask: if the mask includes your original pixels, the model will rewrite your existing content instead of just filling the border. This node sets the padded area to 1 in the mask and your original region to 0, so you're always outpaining the right half.
How it works
Under the hood it's careful arithmetic, not magic:
- It adds your requested padding (
left/top/right/bottom) to each axis. - It rounds the final size to your chosen multiple, adjusting the padding - and if rounding would overshoot, it crops the outer frame by a hair so the math stays consistent. (The
step: 2on the inputs is a hint that even sizes are the plan.) - It fills the new canvas with 0.5 grey (mid-neutral, the standard inpaint starting value) and stamps your original image into place.
- It returns the padded
IMAGEplus aMASKwhere the border is white and your original is black.
The mask is the star. Wire MASK into an inpaint-mask input, and your padding becomes a self-contained outpaint region with zero hand-painting of masks.
Inputs that matter
- left / top / right / bottom - how much to grow each side, in pixels. Zero means "don't grow that side."
- round_to - the multiple to round the final canvas to. 16 is the safe default; 64 is what you'd reach for if you're feeding a Flux-style model that likes bigger blocks.
- Outputs: IMAGE (the padded canvas) and MASK (the border region).
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Maxed-Out-99/ComfyUI-MaxedOut.git
Restart, or ComfyUI Manager → search "Maxed Out" → install. No extra dependencies - pure tensor work.
Troubleshooting
- "Rounding removed the full image on one axis" - you asked for huge padding relative to a tiny image and the rounding math ate it. Increase the original or reduce the padding.
- The outpainted border looks smeared, not regenerated - your mask isn't reaching the inpaint node, or you're sampling at denoise 1.0 instead of 0.5–0.8. Padding the canvas is only half the job; the other half is a proper inpaint sample over the masked area.
- Resolution jumps - if you outpaint in one huge step the model invents more than it can handle. Pad in stages (a few hundred pixels at a time, re-inpaint, repeat) for the good results - this node makes staging trivial since each stage is just another pad+fill.
For the "expand my image past its edges" job, this is the rare node that gives you both halves of the setup in one call.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| left | INT | 00–16384 | — |
| top | INT | 00–16384 | — |
| right | INT | 00–16384 | — |
| bottom | INT | 00–16384 | — |
| round_to | COMBO | 16 | 6 options: None, 2, 8, 16, 32, 64 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |