By · Updated

Straighten Photo Online

Deskew a Crooked Scan or Photo by Detecting Tilt From Straight Lines

No ratings yet

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Image Straightener works

Use this to straighten photo online by a fraction of a degree. Drop in a photo or scan that came out slightly crooked and it is levelled automatically. The tool measures the tilt from the straight lines it finds, such as lines of text, table edges and the horizon, rotates the image by exactly that amount and shows you the angle it used. Nudge it by hand with the manual angle if you prefer. Everything runs in your browser.

Straighten photo online: what to know first

A scan fed slightly askew into a flatbed, a photo of a whiteboard taken in a hurry, a horizon that leans a degree or two: all of these are fixed by a small rotation, and the only question is how much. Rather than guessing, this tool works the angle out from the image itself. It runs an edge detector, then a probabilistic Hough transform, which finds straight line segments among the edge pixels. Each segment has an angle; the tool keeps those within the maximum tilt of horizontal or vertical and takes the median, weighting longer lines more heavily so that a few long text baselines or table rules outvote a crowd of short, random fragments. That median is the tilt, and the image is rotated by its negative to bring it level.

The maximum tilt matters because it decides which lines count. At the default of 15 degrees, a sloping roof or a diagonal shadow is ignored and only near-level lines are measured, which is what you want for scans and documents. Raise it for a photo that is badly off, or lower it to a couple of degrees for a scan you know is nearly right. If the detected angle looks wrong, or if the image has no straight lines to measure, set a manual angle instead; positive values rotate anticlockwise, negative clockwise, in half-degree steps.

Rotating a rectangle inside a rectangle always leaves four empty corners. Canvas chooses between keeping the original size, which crops the corners of the picture but keeps the dimensions you started with, and expanding the canvas so that every pixel of the original stays visible. Fill corners with decides what goes in the gaps: white suits scans, black suits dark photos, transparent gives you a PNG you can place on any background, and edge colours stretches the outermost pixels outward, which is close to invisible on plain backgrounds like sky or paper. The stats report the angle detected, how many lines it came from and the final size, and the download is a PNG so nothing is lost to compression. Very large images are scaled to 2400 pixels on the long side before processing.

FAQ

Why did it rotate the wrong way?

The detected lines were probably a slope in the scene, such as a roof or a shadow, rather than the horizon or text baselines. Lower the maximum tilt so only near-level lines count, or set the angle manually.

Why does it say no lines were found?

The image has no long straight edges, which happens with portraits, landscapes without a horizon and hand-drawn pages. Use the manual angle and judge by eye.

Will it fix a photo taken at an angle to a document?

No, that is a perspective distortion, not a rotation. Use the document scanner, which pulls the page square as well as straight by mapping the four corners back to a rectangle.

Which corner fill should I pick?

White for scans, transparent if the image will sit on a coloured page, and edge colours for photos with plain sky or ground where the stretched pixels blend in. Or choose Expand canvas and crop by hand afterwards.

See also: all Images tools, Audio, Video & Screen, PDF, SVG, Simulations & Screensavers, Generative Art, Chart Makers, 3D Model Viewers, Drawing Pads, Mockups & 3D Making, Diagram Makers, 3D Science, Tracker Music.

Related tools