Scratches, tears and creases are three different problems
Software that offers a single button for damaged photographs is answering three unrelated questions with one method, and it shows. The three differ in one property — how much of the picture survives underneath the damage — and that property decides what a repair can honestly be. Here is the taxonomy, the fill each kind wants, and which of them this page has actually built.
Thin damage: the picture is still there
A scratch, a hair, a speck of dust, the speckle of foxing on the back of a print showing through: all of these obscure a few pixels while leaving the picture intact on both sides of them. That is a strong condition. It means the correct value for every hidden pixel can be reasoned about from the values around it, because the thing the picture was doing before the scratch is still visible where the scratch stops.
The fill for this is fast marching. The boundary of the hole is advanced inward a pixel at a time, nearest to intact picture first, and each pixel becomes a weighted average of the intact pixels within a small radius. Three weights do the work: neighbours lying along the boundary normal count for more than those lying across it, nearer counts for more than further, and neighbours at the same brightness level count for more than those at a different one. The first of those is what carries a gradient through the gap instead of flattening it; the third is what keeps an edge crossing the scratch joined up.
Why it fails past about eight pixels
The weighted average has nothing to say about the middle of a wide gap. Every contribution comes from the rim, and the further in you go the more equally every rim pixel contributes, until the centre is simply the mean colour of the boundary. On a scratch that is invisible. On a gap a centimetre across it is a smooth bruise, and no amount of tuning the weights changes what is fundamentally an absence of information.
Wide damage: the picture is gone
A tear, a missing corner, a hole where a drawing pin went through: the picture that was there is not recoverable from anything nearby, because nothing nearby knows what was in the middle. The only honest approach is to stop averaging and start copying — search the rest of the photograph for patches that match the surviving rim, and paste the best match in. That is exemplar-based inpainting, and its output is texture that genuinely existed in the photograph, arranged where the missing texture was.
It is a good method and it is expensive: a patch search over a large scan is a great deal more arithmetic than a marching fill, and it needs tiling and a worker to stay usable. It is not built here. The marching fill will let you mark a tear — the brush does not stop you — and will produce exactly the smear this piece has described. That is not a bug to report; it is the boundary of the method, made visible.
What this site offers for a tear instead is a third thing, neither a marching fill nor a patch search: a generative model, downloaded on request, that draws what it thinks continues into the gap. It is worth being precise about how that differs from exemplar inpainting, because the two are easy to confuse. A patch search returns texture that genuinely existed somewhere in the photograph. A generator returns texture that existed nowhere, chosen to look like it belongs. On a wall or a sky the difference rarely shows; on a face it is the whole of the matter.
| Damage | Picture underneath | Fill it wants | Built here |
|---|---|---|---|
| Dust, hairline scratches, foxing | Intact either side | Fast marching from the boundary | Yes |
| Tears, holes, missing corners | None | Exemplar patch search | No — a generative model is offered instead |
| Folds and creases | Crushed, with a shadow beside it | Anisotropic fill along the ridge | No — the same model will draw over one |
Creases: the picture is damaged but oriented
A fold is the interesting middle case, and the reason it deserves its own row. The emulsion along the fold has been crushed rather than removed, so there is often some signal left, and the damage has a strong direction — it is a long, near-linear ridge, usually with a shadow along one side of it where the paper lifted.
Treating that as noise and filling it isotropically is the wrong answer twice over. It ignores the one thing you know for certain, which is the direction of the damage, and it averages across the fold rather than along it, so the texture on the two sides gets mixed into a soft line instead of being continued. The right treatment finds the fold as an oriented structure and fills along its own axis, continuing what is on either side. That is also unbuilt here, and marking a crease with the brush will give you a pale line where a crease used to be — better than the crease, some days, and not a repair. The model pass will draw over a crease rather than pale it, which on a fold through a patterned surface is usually the better of the two and is still a guess about what the fold covered.