Nodes/ComfyUI illumorae/Image Infill PatchMatch
ComfyUI Node

Image Infill PatchMatch

The object-removal fill you'll actually reach for

By CorvaeOboro·Created 8 months ago·Updated 6 days ago· 1
Image Infill PatchMatch
  • image
  • mask
  • infilled_image
  • offset_map_viz
patch_size7
iterations5
search_radius50
blend_width12
multiscale_levels2
use_boundary_color_priortrue
boundary_color_weight1.0
use_local_contrast_priortrue
local_contrast_weight2.0
local_contrast_window5
seed0
debug_printsfalse

If you want to remove a tourist from your photo and have the background fill in behind them, this is the node in the pack you actually want. Image Infill PatchMatch is an approximate implementation of the PatchMatch algorithm - the content-aware fill idea that's been in Photoshop for over a decade - which reconstructs a masked region by finding the best-matching patches from the known parts of the image and stitching them into the hole. It sits in the sweet spot of the pack's infill family: smarter than boundary propagate (which just smears colors), faster and less fiddly than exemplar region fill, and honest about being an approximation.

Its stated use case is even more practical than "make the final image": use it to remove an object, then feed the filled image as guidance for a real inpainting pass. The model sees plausible background instead of a black hole, so the inpainted result blends instead of inventing.

How it works

PatchMatch's trick is finding nearest-neighbor patches fast. Instead of exhaustively searching the whole source region for every hole patch, it initializes a rough mapping and then propagates good matches to neighbors, refining as it goes - the algorithm that makes content-aware fill practical at all. This node's version is explicitly approximate: it runs a bounded search within search_radius (default 50), iterating iterations times (default 5), with patch_size (default 7) controlling how much context each placed patch carries. blend_width (default 12) feathers the seams between placed patches so they don't look tiled.

The refinements over a bare PatchMatch:

  • multiscale_levels (default 2) - runs a coarse-to-fine pyramid, which is what makes it handle bigger holes gracefully instead of smearing.
  • use_boundary_color_prior / boundary_color_weight - biases the search toward patches whose colors match the hole's edge, so the fill keeps the right local color cast.
  • use_local_contrast_prior / local_contrast_weight / local_contrast_window - biases toward patches with similar local contrast, so a busy patch doesn't land in a smooth area.
  • seed - reproducibility (the algorithm has randomness in it).

Outputs: infilled_image and offset_map_viz - a visualization of where each patch came from, which is a fascinating window into whether the fill is pulling sensible sources.

Installing it

Part of CorvaeOboro's ComfyUI_illumorae (CC0, pure code, no model downloads). ComfyUI Manager → search illumorae, or:

cd ComfyUI/custom_nodes
git clone https://github.com/CorvaeOboro/ComfyUI_illumorae

Common issues

  • Seams visible between patches - blend_width too low. Raise it toward 16–24; too high and it goes soft instead.
  • Big holes look smeared or repetitive - bump multiscale_levels and iterations, and raise search_radius. If a hole is huge relative to the image, PatchMatch eventually runs out of distinct source material - that's not a bug, that's a data problem.
  • Color cast wrong in the fill - raise boundary_color_weight (default 1, up to 10) so boundary color dominates the patch choice.
  • It's approximate - this is a "rough approximation," per the author's own notes. For textured or complex holes, layer the result into a proper inpainting model rather than shipping the fill as the final image.
Categoryillumorae

Inputs (14)

NameTypeDefaultDescription
imageIMAGE
maskMASK
patch_sizeINT73–31
iterationsINT51–20
search_radiusINT5010–500
blend_widthINT120–50
multiscale_levelsoptINT21–5
use_boundary_color_prioroptBOOLEANtrue
boundary_color_weightoptFLOAT1.00–10
use_local_contrast_prioroptBOOLEANtrue
local_contrast_weightoptFLOAT2.00–50
local_contrast_windowoptINT53–21
seedoptINT00–4294967295
debug_printsoptBOOLEANfalse

Outputs (2)

NameTypeDescription
infilled_imageIMAGE
offset_map_vizIMAGE