Image Infill Exemplar Region Fill
Infill that extends the wall, road, and horizon
- image
- mask
- infilled_image
- fill_order_viz
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) orcheng_blend, with thecheng_*weights (omega,alpha,beta) if you go blend.use_variance_penaltyand itsvariance_*params - penalizes source patches with high variance so you don't copy noisy/edge-heavy patches into smooth areas.variance_topklimits 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. Andseedfor 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_stepsif 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_widthtoo high smearing the boundaries. Drop patch_size, keepblend_widthsmall. - Wrong structure - if the fill keeps picking visually wrong patches, that's the variance/priority balance; turn
use_variance_penaltyup and trycheng_blendmode with a highercheng_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.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| patch_size | INT | 93–21 | — |
| max_stepsopt | INT | 00–1000000 | — |
| priority_modeopt | COMBO | criminisi_2004 | 2 options: criminisi_2004, cheng_blend |
| cheng_omegaopt | FLOAT | 0.700–1 | — |
| cheng_alphaopt | FLOAT | 0.200–1 | — |
| cheng_betaopt | FLOAT | 0.800–1 | — |
| use_variance_penaltyopt | BOOLEAN | true | — |
| variance_alphaopt | FLOAT | 0.900–1 | — |
| variance_betaopt | FLOAT | 0.500–1 | — |
| variance_topkopt | INT | 641–1024 | — |
| enforce_source_disciplineopt | BOOLEAN | false | — |
| blend_widthopt | INT | 00–32 | — |
| seedopt | INT | 00–4294967295 | — |
| debug_printsopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| infilled_image | IMAGE | — |
| fill_order_viz | IMAGE | — |