🌅Image Extend
Pad a canvas for outpainting — Image Extend hands you the mask it knows you need
- image
- mask
- IMAGE
- MASK
Outpainting has two jobs: make the canvas bigger, then get diffusion to paint the empty border. Most people fumble the first job or hand-wave the mask. Image Extend does the first job and returns the mask for the second, which is exactly why you'd reach for it instead of resizing the whole thing and hoping.
What it does
It takes your image and pads it on any combination of the four sides, in pixels you choose:
left_px,top_px,right_px,bottom_px- INTs, 0 to 16384, default 0. Set each side you want to grow.background_white- a FLOAT from 0 to 1 that sets the fill color. Despite the name, it's really a fill value: 0 is black, 1.0 is white, and anything between is a gray. If you want a colored border, this isn't the node - it's black-or-white only.
The original image keeps its pixels untouched and sits at its new offset; everything else is solid fill. No resampling, no blur, no content - that's the point, you're building a canvas for the next step.
The output you actually care about
Two outputs: IMAGE (the padded canvas) and MASK. The mask is the good part. It's white (1) across the added border and black (0) over the original image - which is precisely the mask an outpainting workflow wants to feed into masked sampling. You get the region that still needs filling for free, perfectly aligned, no thresholding a difference image to build it yourself.
There's also an optional mask input if you want to supply your own. Here's the quirk: the code pads your mask and then inverts it, and it treats a fully-black mask as if you passed nothing at all (it warns and drops to the default). So don't feed it an empty mask expecting fine control - you'll get the default border mask back.
How to use it
Classic pattern: Image Extend → outpainting sampler (or a masked KSampler with inpaint conditioning) → the newly painted border replaces the fill. It slots into the standard ComfyUI inpainting/outpainting flow - you want the mask that marks only the unknown area, and that's the one this node hands you.
Where people get burned
- Mistaking
background_whitefor a color picker. It's normalized: 1 = white, 0 = black. Someone inevitably sets it to 255 and gets a black canvas with a confused expression. - Forgetting the mask exists and outpaint-feeding the whole padded image, so diffusion regenerates the original too. Wire the mask.
- Extending to huge sizes in one jump. The inputs allow up to 16384 per side, but a single extreme extension makes the empty area enormous and the sampler has to invent a lot at once - smaller iterative extensions give far more controllable results.
Install
Part of the ComfyUI Production Nodes Pack by Uriel Deveaud (KoreTeknology). Install via ComfyUI Manager (search "ComfyUI Production Nodes Pack"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/KoreTeknology/ComfyUI-Nai-Production-Nodes-Pack
cd ComfyUI-Nai-Production-Nodes-Pack
pip install -r requirements.txt
Restart ComfyUI afterward. No model downloads, no exotic dependencies - it's pure torch and PIL. The pack files its nodes into existing menu categories, so look under image/transform. It's pre-alpha and simple enough that it just works; the author's README is more work-in-progress-sounding than the code is.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| left_px | INT | 00–16384 | — |
| top_px | INT | 00–16384 | — |
| right_px | INT | 00–16384 | — |
| bottom_px | INT | 00–16384 | — |
| background_white | FLOAT | 0.000–1 | — |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |