I have a picture of a document. The camera was not perfectly perpendicular to the document. The top is shorter than the bottom.

How do I create a free form selection around the document in GIMP, and crop it to a perfect rectangle, gradually compacting/stretching the content so that the document looks perfect?

  • 2
    Hi there and welcome to GDSE. Please add to the tags which application you are using or the question is impossible to answer. If you could add an image of the specific document (or something similar) it would also be very helpful.
    – Wolff
    May 10, 2020 at 10:56
  • Apologies. Added.
    – Redsandro
    May 11, 2020 at 13:41

3 Answers 3


The best way is to use Gimp's Perspective tool in Corrective mode. You put the 4 corner handles of the tool on the 4 corners of what should be a rectangle, and let it work its magic.

Caution: none of this really restores the actual aspect ratio, your result will be rectangular but stretched in one dimension, you often have to resort to other clues (easy if the paper format is known) to scale the result along one dimension to restore the proper aspect ratio.

  • 1
    Great answer. Corrective mode is the secret. And it's not the default. Grrr.
    – bfris
    Jun 1, 2022 at 19:09
  • Thanks a lot! This is an essential tool for publishing photos of artworks. Mar 27, 2023 at 18:38

What you seem to be describing is not called cropping. What you are trying to do is a type of perspective distortion. In Photoshop you can use Edit > Transform > Distort, to straighten up a photo of a document so it looks perpendicular. There is also a similar Unified Transform tool (Shift+T) in GIMP (which is free).

Example in Photoshop (before and after)

enter image description here

Example in GIMP 2.10* (before and after)

enter image description here

*Note: I can't remember if Unified Transform was in GIMP 2.8, but you can use the Perspective tool (Shift P) which is similar.

  • This is precisely what I am looking for. I forgot to mention that I am using GIMP, apologies. I am looking for this 'universal transform' tool. Could you add to your answer specifically where to find this? It's not in the transform menu (with the rotation tools).
    – Redsandro
    May 11, 2020 at 13:43
  • Update: The 'cage transform' might be similar, but I'm not sure. It is unusable slow. After moving a point, I have to wait 30(!) seconds for the screen to update on this otherwise smoothly running AMD Ryzen 7 3700X 8-Core with nVidia GeForce GTX 970.
    – Redsandro
    May 11, 2020 at 13:49
  • 1
    @Redsandro sorry it's actually called "Unified Transfrom". The shortcut is Shift+T, it's also available in the toolbox
    – Billy Kerr
    May 11, 2020 at 13:50
  • 1
    @Rosandro - this is in GIMP 2.10. Can't remember if it was in 2.8, but there was the Perspective tool Shift+P which is similar, this also still exists in 2.10.
    – Billy Kerr
    May 11, 2020 at 14:19

Now it's much easier to use the perspective tool in "Corrective (Backward)" mode.

  1. Open the distorted file.
  2. Select the Perspective Tool.
  3. In Direction, select "Corrective (Backward). enter image description here
  4. Adjust the diamond corner markers to the corners of your distorted page. enter image description here
  5. Hit "Transform" which gives you a perfectly flat corrected page. enter image description here
  6. Select "Layer to Image Size"
  7. Scale Image in x and y to make the page dimensions correct: 1920x1080, etc. enter image description here
  8. You have a perfectly rectangular corrected image! Full screen pic: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.