Document Scan Straightener
Turn a skewed phone photo of a page into a straight, readable scan: detect the edges, remove perspective and improve contrast.
-
1Enter data
Enter content, paste text or load a file from disk. -
2Click the button
The tool will immediately process your data in the browser. -
3Get the result
Copy the finished text or save the file to your device.
return "Result ready in 0.1s";
}
Drag the white dots onto the four corners of the page: top left, top right, bottom right, bottom left.
The photo is processed only in your browser and never reaches a server. You can combine several pages into one file with the JPG to PDF tool.
Rate this tool:
Related tools
Other tools you may find usefulThe document scan straightener turns a photo of a page taken at an angle with your phone into a straight, rectangular scan, as if the document had been lying flat on a scanner. The tool detects the page edges, removes perspective distortion, levels the brightness and lets you download the result as JPG or PNG.
How to straighten a document photo
- Choose a photo or drag it onto the box. On a phone, the system file picker lets you take a photo with the camera right away.
- Check the corners. The tool tries to find the page on its own and places four points on its corners. If a point missed, drag it with your finger or mouse.
- Choose the enhancement and proportions, then click "Straighten".
- Rotate the result if the page was lying sideways, and download a JPG or PNG file.
How it works
Page detection
The photo is scaled down and converted to greyscale. Otsu's method finds the threshold that best separates light pixels from dark ones, and the tool then looks for the largest connected light area, which is usually the page. The corners are the extreme points of that area. Detection works best when a light page lies on a darker, even background. When the area is too small (under 12% of the photo) or covers almost the whole photo, the tool asks you to place the corners by hand.
Removing perspective
From the four corners the tool calculates a perspective transform (a homography) that maps the skewed quadrilateral onto a rectangle. Every output pixel is read from the matching place in the photo with bilinear interpolation, so letters stay smooth. The width and height of the result follow from the length of the page edges in the photo, unless you choose A4 or Letter proportions.
Image enhancement
- Black and white scan: adaptive thresholding. Each pixel is compared with the average brightness of its surroundings (a window 1/40 of the image's longer side). It removes shadows and uneven lighting and leaves crisp text on a white background. Best for letters, contracts and notes.
- Greyscale: keeps halftones, e.g. for photos and stamps.
- Colour: stretches the brightness range (the darkest 1% of pixels becomes black, the brightest 1% white), which brightens a greyish page without losing colours.
Output resolution
By default the longer side of the result is at most 2400 pixels, which is enough for a readable printout or email. The "Higher resolution" option raises the limit to 4000 pixels. This is how it translates into print resolution:
| Page format | Longer side | 2400 px | 4000 px |
|---|---|---|---|
| A4 | 297 mm (11.69 in) | about 205 DPI | about 342 DPI |
| Letter | 279.4 mm (11 in) | about 218 DPI | about 364 DPI |
Official documents usually require 200 to 300 DPI. The resolution cannot exceed what the camera actually captured, because enlarging a small photo does not add detail.
How to take a good photo for scanning
- Place the page on a dark, smooth surface. Contrast with the background makes automatic detection easier.
- Shoot in even daylight, without flash and without your own shadow on the page.
- Frame the shot so all four corners of the page are visible.
- Hold the phone as parallel to the page as you can. The tool removes perspective, but a very oblique photo loses sharpness in the far part of the page.
- Do not crop the photo beforehand, because the tool needs the background around the page.
You can combine several straightened pages into one file with the JPG to PDF tool, and read the text from the scan with the image text extractor.
Frequently asked questions
Is my photo sent to a server?
No. Detection, straightening and enhancement happen in your browser. The document is never sent or stored anywhere, so the tool is also suitable for documents with personal data.
Why did the tool not detect the page?
Most often the background is as light as the page, or the page fills the whole photo. Drag the corners by hand or take the photo on a darker background.
How do I save the result as a PDF?
Download the straightened image as JPG, then combine one or more pages with the JPG to PDF tool.
Which enhancement mode should I choose?
For text, the black and white scan. For documents with coloured stamps, signatures or photos, colour or greyscale.
Does the tool work on a phone?
Yes. You can take a photo with the camera from the file picker and drag the corners with your finger. Large photos are automatically reduced to 4000 pixels on the longer side so they do not overload the phone's memory.
Which files does the tool support?
Any image your browser can display, usually JPG, PNG and WebP, and in some browsers also HEIC from an iPhone. The maximum file size is 40 MB.