Kaola Image Expand
Padding for outpainting, with a live preview and a mask that actually helps
- image
- image
- mask
Outpainting in ComfyUI is a two-step dance: grow the canvas, then get a model to invent what fills the new empty space. KaolaImageExpand is step one, and it's the best node in this pack - four independent expand directions, a live preview that updates as you drag the sliders, and, most usefully, a mask that tells your inpainter exactly where the new pixels are.
The classic recipe this plugs into is the standard one from the inpainting playbook: place the original on a bigger canvas, mask the empty area, crank denoising to 0.8–1.0 (the extension is mostly new content), prompt for what should appear there. The pack even ships a Flux example workflow in its repo (workflow/) showing exactly that graph: KaolaImageExpand → mask → inpaint → composite back.
How it works
You feed it an IMAGE plus four integers - expand_left, expand_right, expand_top, expand_bottom, each 0–8192 pixels. It allocates a new canvas of W + left + right × H + top + bottom, pastes the original into the middle, and fills the rim according to fill_mode:
- solid_color - fills with your
fill_colorhex. - edge_color - samples the average color along the original's edge and fills with that. Great for blending into a photo's existing background.
- mirror - flips the border strip of the original out into the padding. No feathering, just reflection.
- blur - and here's the gotcha: in the current release this is a placeholder. The code fills with edge color and never actually blurs; the author's own comment calls it a simplified version. Pick "blur" expecting a soft bleed and you're getting edge color. Plan around it.
feather (0–200) blends the seam between the original and the padding with a gradient toward the fill color - genuinely useful for hiding the hard edge when you outpaint with edge_color.
The outputs that matter
Two of them:
- image - the padded canvas, plain pixels, ready to feed a sampler.
- mask - 1.0 where the original sits, 0.0 in the expanded region. Watch the convention: most inpainting nodes want 1.0 = "regenerate here," so for the standard outpaint graph you'll flip this mask (a core
ImageInvert) before it reaches the sampler. Keep it un-inverted if you're instead using it to composite the inpainted result back over the original, since the mask already marks the protected content.
The preview
The node ships a web extension that adds a live canvas right on the node - drag expand_left and you watch the canvas grow. That's the selling point and it works well. Two things to know: the preview stays blank until you've run the graph once (it draws from the last executed image, not your inputs), and the display options - show_boundary, boundary_color, boundary_width, show_info_on_image - only affect that preview and the temp image it saves. The actual image output is clean. Don't go hunting for boundary lines in your output PNG; they won't be there.
Installation
Standard, and light:
cd ComfyUI/custom_nodes/
git clone https://github.com/kana112233/ComfyUI-Kaola-Nodes.git
Restart ComfyUI after cloning, or use ComfyUI Manager (search "ComfyUI-Kaola-Nodes"). No requirements.txt, no model files, no heavy deps - it's plain torch/PIL tensor math.
Common issues
- Preview blank - run the graph once; it renders from the last execution.
- "Blur" behaves like edge color - placeholder, see above.
- Mask needs inverting for most outpaint samplers - the 1.0-is-original convention catches everyone the first time.
- Memory - values are absolute pixels per side, and expanding a large image all four directions allocates the entire new canvas, so an 8192px all-around expand on a big input can get hungry.
One honest caveat: this node only does the padding half. The expanded area still needs a fill model to invent content - Flux Fill or masked inpainting at native resolution (then upscale, as always). If all you want is a margin or a letterbox without ever outpaint, the pack's other scale node is the better tool.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | 输入图像 | Input image | |
| expand_left | INT | 00–8192 | 向左扩展的像素数 | Pixels to expand left |
| expand_right | INT | 00–8192 | 向右扩展的像素数 | Pixels to expand right |
| expand_top | INT | 00–8192 | 向上扩展的像素数 | Pixels to expand top |
| expand_bottom | INT | 00–8192 | 向下扩展的像素数 | Pixels to expand bottom |
| fill_mode | COMBO | solid_color | 扩展区域填充方式 | Fill mode: solid_color=纯色填充 edge_color=边缘颜色 mirror=镜像填充 blur=模糊填充 |
| fill_color | STRING | #808080 | 纯色填充时使用的颜色(十六进制格式) | Fill color in hex format for solid_color mode |
| feather | INT | 500–200 | 边缘羽化/渐变强度,0=无羽化 | Edge feather/blend strength, 0=no feather |
| show_boundary | BOOLEAN | true | 在预览图上显示原图边界线 | Show original image boundary in preview |
| boundary_color | COMBO | gray | 边界线颜色 | Boundary line color |
| boundary_width | INT | 31–10 | 边界线粗细 | Boundary line width |
| show_info_on_image | BOOLEAN | true | 在预览图上显示扩展信息 | Show expand info on preview image |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |