Pad Image For Diffusers Outpaint
Pad Image For Diffusers Outpaint
- image
- IMAGE
- MASK
- diffuser_outpaint_cnet_image
Outpainting only works if something first decides where your original image sits on the bigger canvas and which parts of that canvas are "new" - that's this node's whole job, and it's the setup step that determines whether your final result looks seamless or obviously pasted-on.
How it works, mechanically: it resizes your source image to fit the width/height canvas you specify (720×1280 by default - turning a landscape or square shot into a tall portrait is the obvious use case), then resizes it again according to resize_image - Full, 50%, 33%, 25%, or Custom (paired with custom_resize_image_percentage, 1-100) if you want the original to occupy less of the frame and leave more room for the model to invent. Then it places the resized image according to alignment - Middle, Left, Right, Top, or Bottom. If your chosen alignment doesn't actually leave room to slide the image that direction on the canvas you gave it, the node quietly falls back to Middle rather than erroring - worth knowing so you're not confused when "Right" doesn't visibly do anything on a canvas too small to shift into.
The mask settings are what determine seam quality. mask_overlap_percentage (default 10, range 1-50) controls how far the mask bleeds into the original image at each edge rather than stopping exactly at the boundary - a small overlap gives the model a strip of real pixels to blend against instead of a hard cut. The four overlap_left / overlap_right / overlap_top / overlap_bottom booleans (all default true) let you turn that blending off per edge - useful if, say, your subject's feet are already right at the bottom of the frame and you don't want that edge softened and partially regenerated.
If your outpaints keep looking obviously stitched, the general lesson from masked outpainting still applies here: generous overlap (the community convention is more like 20-30% of the edge, not this node's conservative 10% default) plus a mask that isn't razor-thin is what avoids the visible seam. Push mask_overlap_percentage up before you blame the model.
Outputs - and this is the part people miss: you get three, IMAGE, MASK, and diffuser_outpaint_cnet_image, but only the third one is meant to feed forward. IMAGE and MASK are preview outputs - the README says outright you can wire them to a preview node just to sanity-check what got padded and what the mask covers before you commit GPU time to a full render. The actual input the Diffusers Image Outpaint node wants is diffuser_outpaint_cnet_image. Wire the wrong output and the main node either won't accept it or you'll be generating against a mask preview instead of the real conditioning image.
Installing it: part of the same pack as everything else here - git clone ComfyUI-DiffusersImageOutpaint into custom_nodes or grab it via the Manager, restart, and pip install -r requirements.txt inside the extension folder if dependencies weren't already pulled in. This particular node needs no model downloads of its own - it's pure image math, no GPU weights involved.
One historical footnote: older versions of this pack needed source images with square corners to mask correctly - a November 2024 update added the editable mask that handles rounded corners too, matching how the original HuggingFace Space behaves, so it's not something you need to work around on a current install.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width | INT | 720 | The width used for the image. |
| height | INT | 1280 | The height used for the image. |
| alignment | COMBO | Where the original image should be in the outpainted one | |
| resize_image | COMBO | Resize input image | |
| custom_resize_image_percentage | INT | 501–100 | Custom resize (%) |
| mask_overlap_percentage | INT | 101–50 | Mask overlap (%) |
| overlap_left | BOOLEAN | true | — |
| overlap_right | BOOLEAN | true | — |
| overlap_top | BOOLEAN | true | — |
| overlap_bottom | BOOLEAN | true | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| diffuser_outpaint_cnet_image | IMAGE | — |