Nodes/ComfyUI illumorae/Image Infill Exemplar Region Fill
ComfyUI Node

Image Infill Exemplar Region Fill

Infill that extends the wall, road, and horizon

By CorvaeOboro·Created 8 months ago·Updated 6 days ago· 1
Image Infill Exemplar Region Fill
  • image
  • mask
  • infilled_image
  • fill_order_viz
patch_size9
max_steps0
priority_modecriminisi_2004
cheng_omega0.70
cheng_alpha0.20
cheng_beta0.80
use_variance_penaltytrue
variance_alpha0.90
variance_beta0.50
variance_topk64
enforce_source_disciplinefalse
blend_width0
seed0
debug_printsfalse

The infill job that kills naive fills is linear structure - a wall edge, a road line, a horizon that has to keep running straight through the hole. Smear-fills blur it into a gradient and it looks like a smudge. Image Infill Exemplar Region Fill is the academic answer to exactly that problem: it's a Criminisi-style exemplar-based fill, the algorithm behind a lot of Photoshop-style content-aware fill, driven by isophote (edge-direction) priority so lines get extended into the hole before flat patches do. This is the node you reach for when the boundary propagate's onion-peel approach is too dumb for the job.

It's also the pack's most configurable infill, so you can take it from "works out of the box" to "fine-tuned to your texture" - and the fill-order visualization is a genuinely nice touch for understanding what it's doing.

How it works

The algorithm, from Criminisi et al. (2004), is elegant: instead of filling pixels in raster order, it computes a priority for every pixel on the hole boundary - a blend of how confident it is (how much known context surrounds it) and how strong the edge structure passing through it is. Pixels on strong edges get filled first, and each fill places a single best-matching source patch rather than averaging several (the brief's "single-copy patch placement instead of voting averages" - that's what keeps edges crisp instead of blurring them into mush). Structure extends; texture follows.

Inputs: image, mask, and patch_size (default 9, odd numbers from 3–21). Bigger patches = more texture captured but more smearing on edges. Then the controls:

  • priority_mode - criminisi_2004 (the classic) or cheng_blend, with the cheng_* weights (omega, alpha, beta) if you go blend.
  • use_variance_penalty and its variance_* params - penalizes source patches with high variance so you don't copy noisy/edge-heavy patches into smooth areas. variance_topk limits how many candidate patches are considered.
  • enforce_source_discipline - restricts patch sources more strictly.
  • blend_width - feathering between placed patches; 0 is hard edges, small values blend seams.
  • max_steps (default 0 = unlimited) - a budget; if fills are slow, cap this. And seed for reproducibility.

Outputs: infilled_image and fill_order_viz - a visualization of which pixels were filled first, which is your best tool for seeing whether structure is propagating correctly.

Installing it

Part of CorvaeOboro's ComfyUI_illumorae (CC0, pure code - this one is NumPy/OpenCV math, no model files). ComfyUI Manager → search illumorae, or:

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

Common issues

  • It's slow - exemplar filling is iterative and each step searches patches; that's inherent. Cap max_steps if you need speed, or use the pack's faster PatchMatch node for object removal.
  • Edges still wobble - patch_size too big for the texture, or blend_width too high smearing the boundaries. Drop patch_size, keep blend_width small.
  • Wrong structure - if the fill keeps picking visually wrong patches, that's the variance/priority balance; turn use_variance_penalty up and try cheng_blend mode with a higher cheng_omega.
  • Use it for prep, not finality - like all these infill nodes, it's a strong input to a real inpainting pass, not a replacement for one on detailed content.
Categoryillumorae

Inputs (16)

NameTypeDefaultDescription
imageIMAGE
maskMASK
patch_sizeINT93–21
max_stepsoptINT00–1000000
priority_modeoptCOMBOcriminisi_20042 options: criminisi_2004, cheng_blend
cheng_omegaoptFLOAT0.700–1
cheng_alphaoptFLOAT0.200–1
cheng_betaoptFLOAT0.800–1
use_variance_penaltyoptBOOLEANtrue
variance_alphaoptFLOAT0.900–1
variance_betaoptFLOAT0.500–1
variance_topkoptINT641–1024
enforce_source_disciplineoptBOOLEANfalse
blend_widthoptINT00–32
seedoptINT00–4294967295
debug_printsoptBOOLEANfalse

Outputs (2)

NameTypeDescription
infilled_imageIMAGE
fill_order_vizIMAGE