On-device AI — professional-grade, fully private.

Images

How to Straighten a Crooked Photo (and Fix Leaning Perspective)

A tilted horizon and a leaning building are two different problems with two different fixes. Here is how to tell them apart, straighten either one, and keep as much of the picture as possible.

Updated October 22, 20265 min read

A photo can be crooked in two quite different ways. In the first, the whole picture is rotated — the horizon slopes, the doorframe leans, the scanned page sits at an angle. In the second, the camera was not facing the subject squarely, so a rectangle has turned into a trapezium: a document photographed from above at an angle, a building whose walls lean inwards, a painting that looks like a kite. Rotation fixes the first. Only perspective correction fixes the second, and using the wrong one just moves the problem around.

Which kind of crooked is it?

What you seeThe problemThe fix
Horizon or floor line slopesThe camera was rotatedStraighten (rotate by a few degrees)
Scanned page sits at an angle, edges still parallelThe page was placed crookedStraighten
Page is wider at the bottom than the topPhotographed at an anglePerspective correction
Building walls lean towards each otherCamera tilted up at the buildingPerspective correction (vertical)
Painting or screen looks like a kiteShot from the sidePerspective correction (four corners)

A quick test: look at two edges that should be parallel. If they *are* parallel but tilted, you need to straighten. If they converge — getting closer together towards one end — you need perspective correction.

Straightening a tilted photo

1

Let it detect the angle first

Open the straighten tool and add the photo. Automatic detection finds the dominant horizontal and vertical lines — a horizon, a table edge, the edge of a page — and estimates the tilt.

2

Fine-tune with the slider

If the photo has no strong lines, or the strongest line is not the one that should be level (a sloping roof, for example), set the angle by hand. Most tilts are between 1° and 5°.

3

Check against a reference line

Judge by something that really is level or vertical: a horizon, a window frame, a door. Do not judge by the edge of a road or a hillside, which may genuinely slope.

4

Export

Save as PNG, JPEG or WebP. Several photos can be processed in one batch, each with its own angle.

Fixing perspective: documents, paintings and buildings

Perspective correction maps four points in the photo onto the four corners of a true rectangle. That one transformation flattens an angled document, squares up a painting and stands a leaning building upright — anything that was a rectangle in real life.

1

Find the corners

In perspective correction, one tap detects the edges of the page or object. For buildings, or anything without clean edges, place the four handles yourself or use guide lines along the walls.

2

Refine on the preview

Drag each corner precisely onto the real corner of the object. The corrected preview beside it updates as you go, so you can see when lines become straight.

3

Keep the real proportions

The output shape is measured from the photo, so an A4 page comes out at A4 proportions rather than stretched to fill an arbitrary rectangle.

For document photos, correcting perspective before you run text recognition makes a big difference: OCR reads straight, evenly sized lines far more accurately than a page that shrinks towards the top.

Edge detection, four draggable corners, guide lines and fine adjustments, with the output proportions measured from the photo. Runs on your device — your documents are never uploaded.

Fix perspective in a photo

Leaning buildings: how far to correct

When you tilt a camera upwards to fit a tall building in, its vertical edges converge. Correcting this fully makes the walls perfectly parallel, which architects and estate agents usually want. But a full correction on a steep shot can make the top of the building look too wide, because our eyes expect a little convergence when looking up.

For a natural look, correct most of the lean but not all of it. For property listings and technical photos, correct it fully. Either way, leave room around the building when you shoot — perspective correction pulls the corners of the frame inwards, and anything close to the edge can be cropped away.

Getting good results from the start

  • Turn on your camera's grid. Lining the horizon up with a grid line removes most tilt before you press the shutter.
  • Shoot documents from directly above. Hold the phone parallel to the page and fill the frame; the less correction needed, the sharper the result.
  • Leave a margin. Both straightening and perspective correction trim the edges. A little extra space around the subject means nothing important is lost.
  • Use the highest resolution. Correction resamples pixels. Starting from a full-resolution photo keeps text and fine detail crisp.
  • Correct before you crop to size. Straighten first, then crop to the aspect ratio you need, so the final framing is based on a level picture.

Rotate by 90° is a different job

A photo that opens sideways or upside down needs a quarter-turn, not straightening. That is usually the camera's orientation tag being ignored by some program. Use rotate and flip for 90°, 180° and mirror corrections — it turns the pixels without resampling them, so there is no quality loss and no crop.

Only after the photo is the right way up does straightening a small remaining tilt make sense. Doing it in that order keeps every step as small as possible, and small corrections are the ones that keep the most of your picture.

Frequently asked questions

How do I straighten a crooked photo without losing quality?

Straightening by a small angle rotates and resamples the pixels, which is visually lossless at normal viewing sizes. The real cost is the crop at the edges, about 3% of the width per degree, so start from a full-resolution original and correct small tilts.

What is the difference between straightening and perspective correction?

Straightening rotates the whole picture to fix a tilted horizon or page. Perspective correction reshapes the picture so a rectangle photographed at an angle — a document, a painting, a building — becomes a true rectangle again.

Can I fix a document photographed at an angle?

Yes. Perspective correction detects the page edges, lets you refine the four corners, and outputs a flat page in its real proportions — ideal before printing, sharing or running text recognition.

Are my photos uploaded?

No. Both straightening and perspective correction run in your browser on your own device, so private documents and photos never leave your computer or phone.

Keep reading

More in Images →