Document scanner
Photograph a page, set its four corners, and get a straight, clean scan. Add as many pages as you need and save them as one PDF.
Lay the page flat on a darker surface, in good light.
Set the four corners
Clean it up
Runs on your device. The camera picture and the photos you pick are never uploaded or saved.
Better scans in four steps
Put a white page on a dark table. The edge finder looks for the bright shape, so a white page on a white desk is hard to find: drag the corners yourself then.
Daylight from a window works well. Hold the phone a little to the side so your own shadow does not fall on the page.
The four corners are mapped onto a rectangle with a perspective transform, so a page shot at an angle comes out as if photographed from straight above.
Each pixel is compared with the brightness around it rather than one fixed level, so text stays sharp even when one side of the page is darker.
Sources: ISO 216 (A-series paper sizes: A4 is 210 × 297 mm); Paul Heckbert, "Fundamentals of Texture Mapping and Image Warping" (UC Berkeley, 1989), for the square-to-quadrilateral perspective mapping; Nobuyuki Otsu, "A Threshold Selection Method from Gray-Level Histograms" (IEEE Transactions on Systems, Man, and Cybernetics, 1979), used to find the bright page; Derek Bradley and Gerhard Roth, "Adaptive Thresholding Using the Integral Image" (Journal of Graphics Tools, 2007), for black and white. The PDF is made on your device with pdf-lib (MIT licence). Photos are redrawn, so their hidden location and camera details are left behind.