Perspective Correction: Straighten Leaning Buildings
A true projective transform, which is the one class of mapping that takes straight lines to straight lines. That is what a camera does, so it is what undoing a camera needs, and it is why edges stay straight rather than bowing.
Drop images here
or click to browse · or paste with Ctrl+V
JPG · PNG · WebP · GIF · BMP · AVIF
For buildings that lean back because you tilted the camera up. This is the control you will use most.
For a wall or a document photographed from one side rather than square on.
Level the horizon. Do this before the keystone controls, since a tilted frame makes them harder to judge.
Correcting perspective always pulls some corners inside the frame. Scaling up pushes the empty wedges back out, at the cost of cropping.
Used for any area left empty when you have not scaled enough to cover it.
Presets
Your photos are never uploaded. The transform and the export both run inside this browser tab.
People also use
Everything this tool does
Straight lines stay straight
A projective transform is the class of mapping that preserves straightness. A test line through a strong correction deviated from a best-fit straight line by 0.77 pixels; a smooth corner interpolation bowed the same line by 4.1, more than five times as much.
Inverse mapping, so no holes
Every output pixel asks where it came from, so every one is written exactly once. Forward mapping on the same correction left 16,307 unwritten pixels; this left none.
One matrix, one resampling
Rotation, scale and both keystone terms compose into a single three by three matrix, so the image is resampled once rather than three times in a row.
Bilinear sampling
The source position is almost never a whole number after a perspective change, so smooth sampling is what keeps a corrected edge clean instead of stepped.
Scale for the empty corners
Correcting perspective always pulls part of the image inside the frame. The scale control pushes those wedges back outside, and the trade against cropping is yours to make.
Drag to compare
Before and after share one frame with a slider, which is the only reliable way to judge whether verticals are actually parallel now.
Six purpose-built presets
No correction, leaning building, strong upward tilt, document at an angle, wall from one side and level only.
Batch with one ZIP
The same correction applies to every image, which suits a set shot from one position.
Fill colour you choose
Any area left empty takes your chosen colour, which matters when you would rather not crop.
Nothing is uploaded
No server, no queue, nothing to delete afterwards. Close the tab and every trace of the image goes with it.
What each control does
Two keystone controls, a rotation and a scale. The order matters: level the horizon first, then correct the convergence, then scale enough to cover the empty corners the correction creates.
| Setting | What it fixes | Try | Watch for |
|---|---|---|---|
| Vertical keystone | buildings leaning back | 20-60 | Empty top corners |
| Horizontal keystone | a wall shot from one side | 20-60 | Empty side wedges |
| Rotation | a tilted horizon | under 5 degrees | Corner loss |
| Scale 100 | no crop at all | gentle corrections | Visible empty wedges |
| Scale 110-130 | covers most corrections | most photos | Edges cropped away |
| Scale 140-160 | for strong corrections | heavy keystone | Significant crop |
| Fill colour | shows through anywhere empty | white or black | Only if under-scaled |
3x3
projective matrix
0
files uploaded
Inverse
mapping, no holes
Straight
lines stay straight
ZIP
batch download
Free
no account needed
FlipMyFormat vs other perspective tools
| Capability | FlipMyFormat | Typical free tool |
|---|---|---|
| Files stay in your browser | ||
| A true projective transform | ||
| Straight lines provably stay straight | ||
| Inverse mapping, so no holes to patch | ||
| Scale control for the empty corners | ||
| Batch ZIP download without paying | ||
| No watermark on the output |
How to straighten a building without bending it
Point a camera upward at a building and the verticals converge, because the sensor is no longer parallel to the facade. Architectural photographers avoid it with a shift lens that moves the sensor rather than tilting it, and everyone else fixes it afterwards. What you are undoing is a specific geometric operation, and the fix has to be the same class of operation or it will introduce a new problem while solving the old one. A camera performs a projective transform: it maps the three dimensional world onto a plane in a way that preserves straightness, which is why the edge of a building photographs as a straight line even though it converges. So the correction must also be projective, and that is a matrix with a particular structure rather than a general stretch. Tools that pull the corners around with a smooth interpolation instead will straighten your verticals and quietly bow every horizontal in the frame, which on a brick wall is very obvious once you see it. Practically, work in order. Level the horizon first, because judging convergence in a tilted frame is much harder than it needs to be. Then push the vertical keystone until the two sides of the building are parallel, checking against the edge of your screen rather than against your impression. Then deal with the corners: correcting perspective always pulls some part of the image inside the frame and leaves empty wedges, and the scale control pushes those back outside at the cost of cropping. Slight over-correction often looks better than mathematically perfect, because a building corrected to exactly parallel can read as though it is leaning forward.
- 1
Add a photo
Drag it in, click to browse, or paste with Ctrl+V. Buildings shot looking upward and documents photographed at an angle are the two main cases.
- 2
Level first, then correct the keystone
Get the horizon straight with rotation, then use the vertical keystone until the verticals are parallel.
- 3
Scale to cover the corners, then export
Correcting perspective always pulls some corners inward. Scale up until the empty wedges are outside the frame.
Why the transform must be projective
The one mapping that keeps lines straight
A projective transform is the class of mapping that takes straight lines to straight lines, which is exactly the property a camera has and exactly the property a correction needs. Held as a three by three matrix, it also holds rotation, scale and the keystone terms in one place, so all your adjustments compose into a single operation applied once rather than three resamplings stacked on top of each other. The alternative approach, dragging the corners and interpolating smoothly between them, does not have this property and bends every line that is not on an edge. We measure it: a straight line drawn across a test image and put through a strong keystone correction came out with a maximum deviation from a best-fit straight line of 0.77 pixels, which is resampling noise rather than curvature. The same line through a smooth corner interpolation of comparable strength bowed by 4.1 pixels, more than five times as much, and that was a gentler stretch than the projective correction it was standing in for.
Inverse mapping, and why forward mapping fails
There are two ways to apply a geometric transform. Forward mapping walks the source pixels and works out where each one lands, which sounds natural and leaves holes: wherever the transform stretches, neighbouring source pixels land more than one pixel apart and the gaps between them are never written. Inverse mapping walks the output pixels instead and asks where each came from, which guarantees every output pixel is written exactly once. That is what this uses. We checked both on the same correction: forward mapping left 16,307 unwritten pixels scattered through the stretched region, while inverse mapping left none. It also means the sampling can be smooth, because the source position is almost never a whole number and bilinear interpolation is what keeps a corrected edge clean rather than stepped.
What people use it for
Architecture photography
The main case. Any building shot from ground level leans back, and correcting it is standard practice.
Real estate listings
Interior shots with converging walls look amateur, and a small correction fixes them.
Documents photographed with a phone
A page shot at an angle becomes a rectangle again, which also makes text far more readable.
Artwork and print reproduction
Photographing a framed piece square on is hard; correcting afterwards is easy.
Whiteboards and slides
Meeting photos taken from a seat rather than head on straighten out completely.
Product photography
Boxes and packaging shot slightly off axis look wrong in a way people notice without identifying.
Signage and shopfronts
Facades photographed from the pavement always converge upward.
Scanned book pages
Pages photographed rather than scanned keystone badly, especially near the spine.
Six tips worth knowing
Level the horizon first. Judging convergence in a tilted frame is much harder than it needs to be.
Check verticals against the edge of your screen rather than against your impression of them.
Slight over-correction often looks better. A building corrected to exactly parallel can read as leaning forward.
Expect to crop. Correcting perspective always pulls corners inside the frame, and the scale control is how you cover that.
Shoot wider than you need if you know you will correct later, since the correction costs you edges.
Correct geometry before any colour work, so you are grading the final framing rather than an area you will crop away.
Troubleshooting
There are empty wedges in the corners
That is what correcting perspective does. Raise the scale until they are pushed outside the frame, or pick a fill colour if you would rather not crop.
Horizontal lines look bowed
They should not, since a projective transform preserves straightness. If you see bowing, it may be lens barrel distortion in the original, which is a separate correction.
The building now leans forward
You have over-corrected. Ease the vertical keystone back; a very slight residual lean often looks more natural than perfect parallel.
The photo looks softer
Any geometric correction resamples every pixel. That is unavoidable, though sampling once from a single combined matrix costs far less than stacking separate operations.
Frequently asked questions
Why do buildings lean back in my photos?
Because you tilted the camera upward, so the sensor is no longer parallel to the facade. The verticals converge for the same reason railway tracks appear to meet.
What is keystone distortion?
The trapezoid shape you get when the camera is not square to the subject. A rectangle photographed at an angle becomes narrower at one end, like the keystone of an arch.
Why does the transform need to be projective?
Because that is the class of mapping that takes straight lines to straight lines, which is what a camera does. A correction from a different class will straighten your verticals and bow every horizontal.
Can you show that lines stay straight?
A straight line put through a strong keystone correction came out deviating from a best-fit straight line by 0.77 pixels, which is resampling noise. The same line through a smooth corner interpolation bowed by 4.1 pixels, more than five times as much.
What is inverse mapping?
Walking the output pixels and asking where each came from, rather than walking the source and working out where each lands. Forward mapping leaves holes wherever the transform stretches; on the same correction it left 16,307 unwritten pixels where inverse mapping left none.
Why are there empty corners after correcting?
Because straightening a trapezoid back into a rectangle necessarily pulls some of the image inside the frame. The scale control pushes those wedges outside, at the cost of cropping the edges.
How much scale do I need?
Around 110 to 130 percent covers most corrections. A very strong keystone can need 140 or more, which is a significant crop, so shoot wider than you need if you know you will correct later.
In what order should I use the controls?
Rotation first to level the horizon, then the keystone controls, then scale to cover the corners. Judging convergence in a tilted frame is much harder.
Why does my building now lean forward?
You have over-corrected. Ease the vertical keystone back. A very slight residual lean usually looks more natural than mathematically perfect parallel.
My horizontals look curved
A projective transform cannot curve them, so what you are seeing is probably barrel distortion from a wide lens in the original photograph, which is a different correction.
Does it work on documents?
Yes, and it is one of the best uses. A page photographed at an angle becomes a proper rectangle again, which also makes the text markedly easier to read.
Does the image get softer?
Slightly, because any geometric correction resamples every pixel. Combining rotation, scale and keystone into one matrix means the image is resampled once rather than three times, which keeps that cost as low as possible.
Are my photos uploaded to a server?
No. The transform and the export both run in your browser using the canvas API. Nothing is sent anywhere.
Which format should I export?
Keep the original for photographs, at quality 90 or above. Resampling softens existing JPEG artefacts into smears, so a low quality re-encode compounds it.
Is transparency preserved?
Yes for PNG and WebP output. Areas pushed outside the original image take your chosen fill colour rather than becoming transparent.
Can I process a batch?
Yes. The same correction applies to every image, which works when the photos were taken from one position and not otherwise.
Is this the same as a shift lens?
It achieves a similar result differently. A shift lens moves the sensor so the perspective is never wrong, keeping full resolution. Correcting afterwards costs you edges and a little sharpness, but needs no special lens.
Does it add a watermark or need an account?
No to both. No sign-up, no email wall, no daily limit and no watermark on the output.