The paste-back trick — why the rest of the picture can't drift
The whole image gets noised and denoised — but after every step, the pixels outside the mask are overwritten with a re-noised copy of the original. Only the hole keeps whatever the model dreamed. Your job: remove the moon from this night scene (dashed region). Run it correctly, then run it with the paste-back turned off and watch the "untouched" parts of the photo mutate into a different scene.
Both runs use the exact same denoising loop — the only difference is whether known pixels get pasted back each step.
Paint a mask, erase a star — context fills the hole
Now you hold the brush. Drag on the image to paint a mask over anything — a star, the moon, a chunk of hillside — then hit Regenerate. The fill is computed from the pixels at the mask's border: the sky continues, the ridge line continues, gradients flow inward. That's the good case: a mask surrounded by rich context gets a seamless, boring, correct fill.
Conceptual simulator — no trained model runs in this page. The fill diffuses in from the mask's boundary pixels, which is exactly the role surrounding context plays for a real inpainting U-Net.
The too-tight mask — nothing coherent fits in there
The #1 beginner mistake: masking the old object pixel-perfectly. A bird sits in this sky; you want a balloon there instead. But a balloon is a different shape — if the mask hugs the bird's silhouette, the balloon must be squeezed into bird-shaped pixels, and the bird's soft edge pixels just outside the mask survive as a dark fringe. Slide the padding and regenerate at each setting.
Padding 0 means the mask is exactly the bird's core silhouette. The balloon needs room the mask doesn't grant.
Mask too much and the model invents a different world
The opposite failure: the fill is anchored by border pixels, and border shrinks relative to area as the mask grows. Mask 30% of the frame and the night sky continues politely. Mask 90% and the surviving sliver can't outvote the model's prior — it hallucinates a completely unrelated scene (here: a sunny desert) that ignores the strip of night still visible at the edges. Drag coverage up and regenerate.
"Prior takeover" is the simulator's actual blend weight between context-driven fill and the model's imagination — computed from how little border survives.
The seam problem — hard edges betray the patch
Even a good fill is never a perfect color match — the regenerated patch here came back a touch brighter and warmer, which is typical. With a hard-edged mask that mismatch becomes a visible cliff at the boundary. Feathering fades the patch into the original over a few pixels, spreading the mismatch until your eye can't find the edge. Drag the slider and watch the measured seam contrast fall.
Seam contrast = average color jump measured across every pixel pair straddling the mask boundary, live from the composite you see.