Perspective Warp (4-Corner)

Drag four corners to give an image real perspective, or mark the corners of a page, sign or screen photographed at an angle and flatten it into a straight-on rectangle. A true homography, not a stretch.

Tool Media & Files Updated Oct 16, 2026
How to Use
  1. Pick a mode. Warp places your image on a four-corner shape (mockups, keystone, tilted posters). Straighten flattens a page, sign or screen you photographed at an angle.
  2. Drop an image on the box, click to browse, or paste one. A sample poster (Warp) or a photo of a page on a table (Straighten) is shown until you do.
  3. Drag the four round handles: in Warp they are the new corners of the picture; in Straighten put them on the four corners of the page in the photo. You can also type each corner as a percentage.
  4. In Straighten, choose the page shape (A4, US Letter, 3:4 or square) or leave it on Auto to take the size from the edges you marked.
  5. Save in any format from the Save panel. Show Work gives the 3×3 transform and where a pixel of your own image came from.
Image & Corners
% of width, % of height
x %y % Top-left Top-right Bottom-right Bottom-left
Presets
Result
Output
—
Top / Bottom Edge
—
Centre Comes From
—
Image Coverage
—

Worked Example

Keystone on an 800×600 image: top corners moved in to 15% and 85%. The corners go to (120, 0), (680, 0), (800, 600) and (0, 600), so the top edge is 560 px and the bottom 800 px. Solving the 8 equations gives the output-to-source transform x = (1.428571 X + 0.285714 Y − 171.428571) ÷ w, y = 1.428571 Y ÷ w with w = 0.000714 Y + 1.

Where the middle goes. The output centre (400, 300) has w = 1.2143 and samples the source at (400, 352.9); going the other way, the source’s middle row y = 300 lands at y = 247.1. The picture now covers (560 + 800) ÷ 2 × 600 = 408,000 of the 480,000 output pixels, 85%, and the two top corners are transparent.

The common mistake: squeezing rows instead of using perspective. Narrowing each row linearly would keep source row 300 at output row 300. That is an affine stretch, not perspective, and it makes the picture look bent. A real tilt compresses the far end, which only a homography (the division by w) reproduces.

Show Work

Load an image to see the transform worked out for its corners.

Formulas

Homography
x = (h₁X + h₂Y + h₃) ÷ w
y = (h₄X + h₅Y + h₆) ÷ w
w = h₇X + h₈Y + 1
Maps an output pixel (X, Y) back to the source point (x, y)
From 4 corners
h₁X + h₂Y + h₃ − h₇Xx − h₈Yx = x
h₄X + h₅Y + h₆ − h₇Xy − h₈Yy = y
Two equations per corner, 8 in all, solved by Gaussian elimination
Bilinear sample
c = (1−f)(1−g)c₀₀ + f(1−g)c₁₀ + (1−f)g c₀₁ + fg c₁₁
f, g = fractional position between the four nearest pixel centres
Straighten size (Auto)
W′ = max(top, bottom)
H′ = max(left, right)
Edge lengths of the marked quadrilateral; a page shape sets H′ = W′ × ratio instead
Coverage (Warp)
A = ½ |Σ (xᵢyᵢ₊₁ − xᵢ₊₁yᵢ)|
Shoelace area of the new corners ÷ the canvas area

From Renaissance Perspective to Document Scanners

Linear perspective, the rule that parallel lines appear to meet at a vanishing point, was worked out by artists and architects in early 15th-century Florence, and Leon Battista Alberti set out a construction for it in his treatise De pictura in 1435. The mathematics behind it, projective geometry, shows that any flat picture seen from any viewpoint is related to the straight-on view by one transform with eight free numbers: the homography this tool solves.

The same idea runs every phone document scanner, whiteboard app and sports broadcast that draws lines on a pitch: find four points whose true positions are known, solve for the homography, and every other point follows. Architectural photographers do it optically with shift lenses; this tool does it with arithmetic, one output pixel at a time.

About This Tool

This tool applies a true projective transform defined by four corners you drag: either placing the whole image on a new four-cornered shape, or flattening a four-cornered region of a photo into a rectangle of the shape you choose. Every output pixel is traced back through the inverse transform and sampled bilinearly, and Show Work prints the 3×3 matrix and a traced pixel.

Images are decoded and saved in your browser by the engine behind the Universal Image Converter, so HEIC, TIFF and RAW files work too. Large images are previewed at reduced size and transformed at full size when you save. Nothing is uploaded.

Related tools: Rotate, Flip & Mirror, Image Cropper, and Image to PDF.

Frequently Asked Questions

What is a homography?

It is the transform a camera applies to any flat surface: it keeps straight lines straight, but parallel lines can meet and equal steps get shorter with distance. It has 8 unknowns, so 4 corner pairs (each giving an x and a y equation) fix it exactly. The tool solves those 8 equations, then for every output pixel works out which point of the source it came from.

Why is this better than squeezing the top of the image?

Squeezing each row linearly keeps the middle row of the picture in the middle, which looks bent rather than tilted. In real perspective the far, narrow end is compressed: narrow the top of an 800×600 image to 560 px and the source’s middle row (y = 300) lands at y = 247 in the result, while the result’s middle samples source row 352.9.

How do I straighten a photo of a document?

Choose Straighten, drop the photo and drag the four handles onto the page corners, in order top-left, top-right, bottom-right, bottom-left. Pick the paper shape (A4 is 1 : 1.414, US Letter is 8.5 : 11) so the result has the right proportions. The output is a flat, straight-on rectangle, ready to print, run through OCR or turn into a PDF.

Why are the corners transparent in Warp mode?

The picture now covers only the four-cornered shape, so the rest of the canvas is left transparent for placing it over a mockup or background. Save as PNG or WebP to keep the transparency; JPG has no transparency and fills it with white.

Is my image uploaded?

No. The image is decoded, transformed and saved in your browser by the same engine as the Universal Image Converter, so HEIC, TIFF and RAW files work too. Large images are previewed at reduced size and transformed at full size when you save.

How do I use the Perspective Warp (4-Corner)?

Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.

Is it free? Does it work without internet?

Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.

Where does my data go?

Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.

Common Use Cases

Scan a document with a phone

Flatten an A4 page shot at an angle on a desk into a straight 1 : 1.414 rectangle, ready to print or OCR.

Mockups

Place a 1920×1080 screenshot onto the tilted screen of a laptop photo by dragging its corners onto the screen.

Signs, whiteboards and paintings

Square up a whiteboard photographed from the side of the room so the writing reads evenly.

Keystone and depth effects

Narrow the top of a poster to 70% of its width for a leaning-back, floor-standing look.

Last updated: