A5Pad Image for Outpaint
A bigger canvas, and the mask to fill it
- image
- padding_color
- image
- mask
- width
- height
Outpainting is two mechanical steps: put the image on a bigger canvas, then invent the empty part. This node does step one properly and hands you the mask for step two.
It doesn't resize your image. That's the point. Aspect-ratio presets just expand the canvas around it, so a 3:4 photo can become a 16:9 frame with your subject untouched in the middle, plus room for a model to paint the rest.
How it works
The node allocates a canvas of the width and height you asked for, fills it with padding_color, and drops the source image somewhere inside it. Then it builds a mask: fully on (1.0) in the padded area, tapering from your source pixels down to zero across feathering pixels of the source edge.
Two ways to finish that edge:
- fade img to color blends the source image's edge into the padding colour as it goes, so the seam is pre-softened before any model sees it.
- mask only leaves your source pixels alone and just shapes the mask.
Feathering only applies on sides where you actually padded - extend left and the left edge feathers; the right edge stays hard. There's also a guard worth knowing: if feathering is zero, or the feather is more than half the source in either direction, or you didn't pad anything, the mask comes back flat. Small image, big feather value, and you silently get a hard edge instead of a soft one.
The aspect_ratio dropdown expands the canvas without resizing the image, and image_placement decides where the picture sits in it - fit left, fit right, fit top, fit bottom, or center. Combined with the four manual padding fields, you can both extend a side by hand and force a target aspect ratio in one pass.
Inputs and outputs
- image
- left / top / right / bottom - pixels to add on each side, in steps of 8, which keeps most of your multiples-of-8 problems solved-for automatically.
- feathering, feather_mode, padding_color - the colour is a hex value you can pick off the canvas with the eyedropper, which matters more than it sounds: a grey that clashes with your photo makes a worse seam than one sampled from the sky.
- aspect_ratio, image_placement - as described.
Outputs: image (the padded canvas), mask, width, height. The mask is the useful one. Wire the image and mask into the inpainting conditioner your model wants, and the width/height integers into the latent or whatever else is sizing the pass, so nothing disagrees about the canvas.
Using it
The classic masked route, which still wins when the original has to survive byte-for-byte: pad here, send image and mask into an inpaint encode, denoise high - 0.8 to 1.0, because the extension is new content, not a correction. If you want the untouched original composited back at the end instead of a full VAE round trip, that's the composite-after-inpainting rule, and it's the difference between one extension and five.
There's also the 2026 shortcut worth knowing about. On an instruction model, people pad with an obviously artificial colour and just ask for it to be replaced - pad with red, prompt "remove the red padding and show what's behind it". padding_color plus the face that this node gives you an image with no mask wired at all is everything that trick needs. It's fast, needs no sampler settings, and it's what instruction editing took cleanly. The mask route is for when the pixels you already have are the ones you want to keep.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/A5Projects/ComfyUI-A5Nodes
Restart ComfyUI and refresh the browser; or install A5 Custom Nodes from ComfyUI Manager and pick the numbered release rather than the Nightly one. No Python packages, no model files. Disable any standalone copy of these nodes first - the pack keeps the old node IDs, and duplicates cause duplicate registrations.
Where it breaks
Asymmetric padding, asymmetric expectations. fit left means you only extended the right, so any prompt about "the left side" is nonsense. Check which way you actually grew the canvas.
Feathering near the limits. As above: feather values at or above half your source dimension get ignored, and the mask comes back hard-edged. On a 512-wide image, anything from 256 up does nothing.
Visible seams. The classic outpaint failure - the extension looks pasted on. The fixes are all in the inputs: pad generously, feather rather than butt-joining, and don't ask one pass to both extend the frame and repaint the subject.
Colour mismatch in the new region. If the padding colour is fighting the generated content, a colour-match pass toward the original is the cheap deterministic fix, and it's the same tool you'd use to settle a tile boundary in an upscale.
Inputs (10)
| 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 | — |
| feather_mode | COMBO | fade img to color | Fade the image edge into the padding color, or feather only the mask. |
| padding_color | COLOR | #808080 | — |
| aspect_ratio | COMBO | disabled | Expands the canvas without resizing the image. |
| image_placement | COMBO | center | Positions the image within aspect-ratio padding. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| width | INT | — |
| height | INT | — |