Document scanner
MDV ToolsPhotograph a page, set its four corners, and take away a flat, white scan.
- Photo
- Page
- Written
- nothing yet
How this works
Three steps, all in this tab, none of them needing a library. Straighten: the four corners you set are mapped onto a flat rectangle with a perspective transform — the page is solved for the eight numbers that carry one quadrilateral onto the other, and every pixel of the scan is read back from the photo through that mapping, blended from its four nearest neighbours. Clean: the page's lighting is estimated at low resolution by spreading the brightest nearby value over the text, which erases it and leaves only the paper and its shadows, then smoothing what is left; each colour is divided by that estimate, so the paper comes out white wherever the light fell and a yellow lamp's cast goes with it. A tone curve then darkens the ink. Black and white splits the cleaned page at the threshold that best separates two tones (Otsu's method). Save: PNG and JPEG come from the canvas; the PDF is written here byte by byte, one page holding the JPEG at exactly the page size, with no author, date or software name inside.
A4 and Letter give the page its real proportions at 300 dots per inch — 2480 × 3508 pixels for A4. As photographed takes the proportions from the corners you set, which is close but not exact when the photo was taken at a steep angle, since a far edge looks shorter than it is; pick the paper size when you know it. Photos are worked at up to 4,000 pixels on the long side and pages at up to 3508, which keeps a phone's memory in hand; a bigger photo is scaled down first and the page says so. Pages with large dark areas — photographs, black boxes — are lightened by the clean-up, because the lighting estimate cannot tell a dark picture from a shadow: use Straighten only for those.
What it does not do: it does not find the corners by itself, flatten a curved book page or a fold, or read the text — the PDF holds a picture of the page, not searchable words. Nothing is kept: close the tab and the photo and the scan are gone, so download before you leave. The page makes no network requests; the Dark button keeps its own setting in this browser's local storage.