Nodes/ComfyUI-AusBoss/Crop For Inpaint πŸ†Ž
ComfyUI Node

Crop For Inpaint πŸ†Ž

Cuts the masked region plus surrounding context out of an image so an inpainter works at native resolution, and emits a stitcher that Stitch Inpaint πŸ†Ž uses to paste the result back seamlessly. The selection can be inverted, grown or shrunk, and edge-softened before cropping; context comes from a growth factor plus optional flat pixels. target_megapixels rescales the crop to a sampler-friendly area, and the extend inputs grow the frame itself for outpainting. By default the sampling mask stays hard-edged; feathering lives in a separate blend mask used only while pasting. An empty mask selects the full image and stitches back unchanged.

By ausbossΒ·Created about a month agoΒ·Updated 7 days agoΒ· 2
Crop For Inpaint πŸ†Ž
  • image
  • mask
  • image
  • mask
  • stitcher
β—„context_factor1.20β–Ί
β—„blend_pixels16β–Ί
β—„output_multiple8β–Ί
β—„target_width0β–Ί
β—„target_height0β–Ί
β—„mask_grow0β–Ί
β—„mask_blur0.0β–Ί
β—„invert_maskfalseβ–Ί
β—„context_pixels0β–Ί
β—„target_megapixels0.00β–Ί
β—„rescale_algorithmbilinearβ–Ί
β—„extend_left0β–Ί
β—„extend_right0β–Ί
β—„extend_up0β–Ί
β—„extend_down0β–Ί
CategoryπŸ†Ž AusBoss/Inpaint

Inputs (17)

NameTypeDefaultDescription
imageIMAGEBHWC image or video frames to crop around the mask.
maskMASKWhite marks the area to inpaint. A multi-frame mask is unioned into one crop window; an empty mask selects the whole image.
context_factorFLOAT1.201–10Grows the mask bounding box symmetrically by this factor so the inpainter sees surrounding context.
blend_pixelsINT160–256Feather width for pasting the result back: the paste mask is widened by this many pixels and blurred. The sampling mask is never feathered. 0 pastes hard.
output_multipleINT81–128Crop and target dimensions are rounded up to a multiple of this so samplers accept them.
target_widthoptINT00–16384Rescale the crop to this width for the sampler; 0 keeps the native crop width (or follows target_height at the crop's aspect ratio).
target_heightoptINT00–16384Rescale the crop to this height for the sampler; 0 keeps the native crop height (or follows target_width at the crop's aspect ratio).
mask_growoptINT0-256–256Dilate the sampling mask by this many pixels (negative shrinks) so the inpainter repaints past the drawn edge. Reshapes what gets painted, unlike blend_pixels which only feathers the paste-back.
mask_bluroptFLOAT0.00–64Gaussian sigma softening the sampling mask's edge for models that honor soft masks. 0 keeps the hard edge.
invert_maskoptBOOLEANfalseInpaint the black area instead of the white area β€” everything outside the drawn region.
context_pixelsoptINT00–4096Flat extra context in pixels added around the mask box after context_factor's growth.
target_megapixelsoptFLOAT0.000–64Rescale the crop for the sampler so its area is about this many megapixels β€” 1.0 suits SDXL-class models, 0 keeps the native crop size. Explicit target_width/height overrides this.
rescale_algorithmoptCOMBObilinearResize filter for the sampler round trip. bilinear is the safe default, bicubic keeps upscales a touch crisper, area suits heavy downscales, nearest never invents pixels.
extend_leftoptINT00–8192Outpainting: grow the frame this many pixels leftward. The new band is added to the mask and becomes part of the stitched output.
extend_rightoptINT00–8192Outpainting: grow the frame this many pixels rightward. The new band is added to the mask and becomes part of the stitched output.
extend_upoptINT00–8192Outpainting: grow the frame this many pixels upward. The new band is added to the mask and becomes part of the stitched output.
extend_downoptINT00–8192Outpainting: grow the frame this many pixels downward. The new band is added to the mask and becomes part of the stitched output.

Outputs (3)

NameTypeDescription
imageIMAGECropped BHWC region around the mask, sized for the sampler.
maskMASKHard-edged sampling mask matching the crop; never feathered.
stitcherAUSBOSS_STITCHERStitch data for Stitch Inpaint πŸ†Ž: canvas, rects, blend mask, scale.