Nodes/ComfyUI-Kaola-Nodes/Kaola Image Expand
ComfyUI Node

Kaola Image Expand

Padding for outpainting, with a live preview and a mask that actually helps

By kana112233·Created 8 months ago·Updated 8 months ago· 0
Kaola Image Expand
  • image
  • image
  • mask
expand_left0
expand_right0
expand_top0
expand_bottom0
fill_modesolid_color
fill_color#808080
feather50
show_boundarytrue
boundary_colorgray
boundary_width3
show_info_on_imagetrue

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_color hex.
  • 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.

Categoryimage/transform

Inputs (12)

NameTypeDefaultDescription
imageIMAGE输入图像 | Input image
expand_leftINT00–8192向左扩展的像素数 | Pixels to expand left
expand_rightINT00–8192向右扩展的像素数 | Pixels to expand right
expand_topINT00–8192向上扩展的像素数 | Pixels to expand top
expand_bottomINT00–8192向下扩展的像素数 | Pixels to expand bottom
fill_modeCOMBOsolid_color扩展区域填充方式 | Fill mode: solid_color=纯色填充 edge_color=边缘颜色 mirror=镜像填充 blur=模糊填充
fill_colorSTRING#808080纯色填充时使用的颜色(十六进制格式) | Fill color in hex format for solid_color mode
featherINT500–200边缘羽化/渐变强度,0=无羽化 | Edge feather/blend strength, 0=no feather
show_boundaryBOOLEANtrue在预览图上显示原图边界线 | Show original image boundary in preview
boundary_colorCOMBOgray边界线颜色 | Boundary line color
boundary_widthINT31–10边界线粗细 | Boundary line width
show_info_on_imageBOOLEANtrue在预览图上显示扩展信息 | Show expand info on preview image

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK