Image Infill PatchMatch
The object-removal fill you'll actually reach for
- image
- mask
- infilled_image
- offset_map_viz
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_widthtoo low. Raise it toward 16–24; too high and it goes soft instead. - Big holes look smeared or repetitive - bump
multiscale_levelsanditerations, and raisesearch_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.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| patch_size | INT | 73–31 | — |
| iterations | INT | 51–20 | — |
| search_radius | INT | 5010–500 | — |
| blend_width | INT | 120–50 | — |
| multiscale_levelsopt | INT | 21–5 | — |
| use_boundary_color_prioropt | BOOLEAN | true | — |
| boundary_color_weightopt | FLOAT | 1.00–10 | — |
| use_local_contrast_prioropt | BOOLEAN | true | — |
| local_contrast_weightopt | FLOAT | 2.00–50 | — |
| local_contrast_windowopt | INT | 53–21 | — |
| seedopt | INT | 00–4294967295 | — |
| debug_printsopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| infilled_image | IMAGE | — |
| offset_map_viz | IMAGE | — |