What the model is for, and what it is not
This page has always divided print damage by width, and the division has always had a hole in it. Narrow damage — dust, hairline scratches, cat hairs on the platen, the speckle of foxing — is closed by averaging the intact picture within a few pixels of each marked one, and that works because the photograph either side of a hairline still agrees about what should be there. Wide damage has no such agreement. Across a torn corner there is no intact picture in the middle to average, so the average reaches further and further for something to hold on to and returns a smear.
An inpainting model is a different kind of answer to that. Rather than averaging, it generates: it is shown the hole with its contents removed, and it draws what it thinks continues into the gap. On a crease across a brick wall, a sky, a lawn or a patterned dress that is a repair nothing local could have made. On a crease across somebody’s face it is a guess about a face, and it will make one confidently.
- What it draws is invented, not recovered. The paper under a tear records nothing, so there is no signal anywhere for a model to find. It produces something plausible for the gap, which is a different claim from producing what was there. Where the missing region held a face, a hand or a sign, treat the result as a reconstruction and say so if you pass the picture on.
- It adds no colour that was never recorded. Fade recovery stretches the range each channel still holds, and the model redraws inside the mask using the colours around the hole. Neither invents a hue for a monochrome print. A grey photograph comes out of both passes grey.
- Nothing here rates the result. This site quotes sizes and run times because they were measured, and it does not quote a quality figure because none was. Whether a redrawn crease is better than a filled one is a judgement about your photograph, which is why the comparison control and the undo history are where they are.
- It does not make the picture bigger. One of the two models is a super-resolver, used inside the pass so that a square drawn on a 512-pixel grid lands in a flatbed scan at something nearer the scan’s own resolution. The file you save has exactly the pixel dimensions of the file you opened. There is no enlargement control on this site and this is not one.
What it costs before it runs
Nothing on this page fetches anything until a control that names the size has been pressed. These are the exact lengths of the files, not rounded estimates and not figures copied off a model card — the network keeps one registry of measured sizes, and these are read out of it by the same code that draws the button.
| File | Exact size | Where from |
|---|---|---|
| ONNX Runtime, WebAssembly build | 13,986,063 bytes (13.3 MB) | This domain |
| Damage filler — inpainting, MIT | 26,639,447 bytes (25.4 MB) | cdn.pictureeditor.com |
| Detail pass — optional, BSD-3-Clause | 4,866,396 bytes (4.6 MB) | cdn.pictureeditor.com |
| Everything, with the optional pass on | 45,491,906 bytes (43.4 MB) | Two hosts, one of them this one |
The runtime is the larger half of that and it is not the model. ONNX Runtime’s WebAssembly build is what executes a graph in a browser tab at all, it is served from this domain rather than from anywhere else, and it is the reason the first model pass on any site in this family costs what it costs. Everything after it is comparatively small.
Kept, and deletable
A completed download is written into a named cache in your own browser, and the name carries a version — so a future model is a new bucket rather than a stale file served under an old address. The second pass fetches nothing and works offline. A file that arrives at a length the registry does not recognise is refused rather than kept, because a truncated graph fails much later and much less clearly than a download that plainly did not finish. The panel carries a control that deletes both models again.
Declining costs you nothing but the wide damage
The local engine is not a fallback bolted on for appearances; it is what this site was and still is. Detection, the editable mask, the fill, the per-channel fade recovery and the written report all run with nothing downloaded, and the save path is the same one. Declining leaves you a tool that closes dust, hairlines and foxing properly and says honestly that a tear is beyond it.
How a pass is put together
The order never varies, on screen or in the export: the scan is read for damage, the reading is thresholded into a mask you can edit, the mask is filled locally, the wide regions are redrawn, and the tone curves go last. The model is inserted into an existing order rather than replacing it, which is why a pass can be run, looked at, undone and run again without the rest of the repair moving.
| Step | What it does | Why it is that way |
|---|---|---|
| Sort the mask by width | Connected regions are measured; those whose shortest side exceeds twice the fill's reach are candidates | A region narrower than that has intact picture within reach of its middle, and the local average is the better answer there |
| Cut a square around each | Two and a half times the damage, clamped to the photograph, never smaller than the model's own 512 | A window cropped tight gives the model nothing to continue from; a window smaller than 512 would be scaled up into invented detail |
| Redraw, up to eight squares | One run of the inpainting model per square, each with the hole's contents removed before it is shown | The model never sees what was under the mask, so the fill is a redraw rather than a blur of the damage |
| Re-render each square, optionally | The drawn square is run through the second model in 128-pixel tiles, and only the tiles holding damage | The fill is drawn on a 512 grid and the window is often several times that; tiles with nothing marked in them would be discarded anyway |
| Write back inside the mask only | Every pixel outside the marked regions is the scan's own, untouched | A generator redraws the whole square it is shown, and taking its version of the surroundings would quietly resample the photograph around every repair |
Saving re-runs the whole of that at the original resolution rather than enlarging what was on screen. A model square is 512 pixels whatever it was cut from, so repeating the pass on a twenty-megapixel scan costs about what it cost on the preview instead of costing it per megapixel — the squares are simply cut from bigger pixels.
Questions about the model
- Is the model looking at my photograph on somebody's server?
- No. The direction of travel is the other way round: the weight files come down to your browser and the scan never goes up. There is no server here that accepts a file — this site is a set of static pages, and a check in the build refuses to publish it if a code path that could transmit a picture ever appears. What is fetched is two model files from the network's own storage at cdn.pictureeditor.com, on request, once, plus the runtime that executes them from this domain. Both are programs. Neither request carries anything about your picture, and the privacy page describes the whole of it.
- Does it restore what was actually in the photograph?
- No, and nothing can. The paper under a tear holds no picture, so there is no record anywhere of what was in that part of the frame. An inpainting model draws a continuation of what surrounds the hole that looks like it belongs — a wall that carries on, a sky that carries on, a coat sleeve that carries on. Where the missing region held something unique, a face or a hand or the writing on a sign, what comes back is invention in the shape of the thing that should be there. Hold the space bar to put the scan back as it arrived and decide for yourself whether the invention is one you want to keep.
- Why does it only redraw some of what I marked?
- Because the local fill already closes the rest, and closes it better. Anything narrow enough that the picture either side of it still agrees about what should be there is repaired by averaging that picture — which uses the photograph's real pixels rather than a guess. The model is offered only the regions whose shortest side is wider than twice the fill's reach, because those are the ones with pixels in the middle that have nothing intact within reach in any direction. A model run over dust would spend two and a half seconds inventing what an average had already got right.
- How long does a pass take?
- One run of the fill model per redrawn square, and the registry the network measures its models in records 2,420 ms for that run on single-threaded WebAssembly. Eight squares is the limit in one pass, so the fill half is bounded. The optional pass that re-renders each drawn square is the slow half by a wide margin: it works in 128-pixel tiles at 1,200 ms a tile in the same measurement, and it runs a tile for every part of a square that has damage in it. Both counters say which step they are on, and the figures are per run on a machine that is not yours — your own will differ.
- Can it bring the colour back to a faded print?
- It can bring back range, not hue, and that distinction is the whole of the honest answer. The tone controls measure what each colour channel still holds and stretch it to full scale, which on most faded prints is what reads as the colour returning. Neither the tone pass nor the model puts a colour into a photograph that never recorded one: on a black-and-white print all three channels hold the same thing, and three identical channels stretched are still three identical channels. Colourising a monochrome print is a different operation with a different model, and it is not on this page.
- Can I use it without downloading anything?
- Yes, and that is the default. Open a scan and the local engine reads it for damage, shows you the mask, closes what it can and corrects the fade, with nothing fetched from anywhere. The model panel sits beside those controls with its size on it, and it stays a button until you press it. Press it once and both files are kept in this browser's cache, so the second pass fetches nothing and works with the network switched off. There is a control that deletes them again.
Where to go next
The local engine and its two openings are on the first three cards; the reading behind all of it is on the fourth. The piece on what restoration cannot bring back is the one worth reading before a pass on a photograph that matters, because the model does not move that line — it only changes which side of it a crease falls on.
- RepairImageDetection, an editable mask and the fill, on one column.
- Scratches and dustOpens with detection turned up and the brush already out.
- Restore an old photographOpens on fade correction, for a print that has gone pale and warm.
- What restoration cannot bring backSilvering, mould, missing faces, and the honest end of the list.