Nodes/ComfyUI-ZoeyTool/Zoey - 框选裁剪/外扩
ComfyUI Node

Zoey - 框选裁剪/外扩

Drag a frame to crop or extend your canvas — the outpainting prep node with fill color and feathering

By liangzoey·Created about a year ago·Updated 3 days ago· 5
Zoey - 框选裁剪/外扩
  • image
  • 输出图像
frame_left-0.100
frame_top-0.100
frame_right1.100
frame_bottom1.100
填充颜色#808080
fill_modetrue
feather0
ratio_modefalse
target_ratio16:9

ZoeyOutpaintFrame is the spatial-precision node for the two jobs nobody wants to do with math: cropping to a drawn box, and expanding a canvas outward so you can outpaint into it. You drag a frame over your image in the node body - pull the edges inside the image and it crops; pull them past the borders and it grows the canvas into gray, ready for an inpaint/outpaint pass to fill. That "prepare the region" step is the part of outpainting workflows people improvise with a dozen math nodes and get wrong; this makes it a visual, reproducible setting.

It comes from comfyui-ZoeyTool (Zoey Tool/图像处理), whose sibling nodes (mask drawing, light handles, multi-canvas) share the same interactive-framing approach. The workflow it feeds is standard outpainting: expand the canvas here → send the image plus a mask of the empty region to an inpaint sampler → done.

How it works

Your drag is translated into four normalized frame values - frame_left, frame_top, frame_right, frame_bottom - where 0–1 spans the original image and values below 0 or above 1 push the frame outside it (defaults start you at -0.1 … 1.1, a slight outward margin). The node then builds a new canvas of whatever size the frame defines, pastes the source image at its position, and fills every added pixel with 填充颜色 (a hex color, default mid-gray #808080 - the classic inpaint-neutral).

The inputs that matter when you're aiming for usable outpainting:

  • fill_mode - on (default), and when the frame sits inside the image, the boxed-off exterior is filled and the output stays the original image size (a fill-and-crop); when the frame extends beyond, you get the bigger canvas. Off, and the output is exactly the frame's dimensions with the image pasted inside - pure reframe.
  • feather - blurs/blends the seam where image meets fill (0–200 px), so your inpaint mask region has a soft edge instead of a hard cutoff.
  • ratio_mode + target_ratio - snaps the canvas to a fixed aspect (16:9, 9:16, 1:1, 21:9…), keeping the frame centered while it adjusts. Handy when the destination needs a specific aspect and you don't care exactly how much you outpainted on each side.

The output is 输出图像 - the new, framed canvas. From there, the standard move is to build a mask of the gray/fill area and feed both into your inpaint sampler.

Installing it

comfyui-ZoeyTool, as with the rest of the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/liangzoey/comfyui-ZoeyTool.git
cd comfyui-ZoeyTool
pip install -r requirements.txt

Restart ComfyUI (or ComfyUI Manager → comfyui-ZoeyTool). Pure tensor work - no downloads, no models.

Where people get burned

The fill-color default being gray rather than the image's true edge color means a wide outpaint shows a visible gray border in your preview; that's normal - the inpaint is supposed to paint over it, so match the mask to the filled region and don't expect the fill itself to look finished. Second, fill_mode's behavior differs inside vs outside the image - "on + inside frame" keeps original dimensions, "on + outside frame" expands. It reads as inconsistent until you remember the frame defines a region, not a crop mode. Third, values are clamped per-side but wildly asymmetric frames (drag far past one edge) can produce enormous canvases that your VRAM will quietly hate during the inpaint pass - keep expansions modest unless you're on a big card.

CategoryZoey Tool/图像处理

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
frame_leftFLOAT-0.100-5–1
frame_topFLOAT-0.100-5–1
frame_rightFLOAT1.1000–5
frame_bottomFLOAT1.1000–5
填充颜色STRING#808080
fill_modeBOOLEANtrue
featherINT00–200
ratio_modeBOOLEANfalse
target_ratioCOMBO16:98 options: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, +2

Outputs (1)

NameTypeDescription
输出图像IMAGE