How to Straighten Buildings using Photoshop or the GIMP

28 Mar 2010
Posted by kmcgrail

Due to the fact that buildings are so much taller than people, taking their photo at ground level results in a lens distortion effect.  The result is a photo of a building with slanting walls.  Using a wide angle lens increases the distortion.  Below I have provided a description how to correct this using photoshop and also using the GIMP. 

Using the GIMP:

  1.  Load image.
  2. Add guides by grabbing at the ruler and dragging to the image.  The guides help make sure that the building lines are straight while you do your adjustments.
  3. Rotate the canvas if necessary to straighten the image. To do this, go to Layer -> Transform -> Arbitrary Rotation -> adjust the angle to make the image straight then click 'rotate'. Use a horizontal guide bar to help make the image straight.
  4. Adjust the perspective of the image to straighten the edges of the building.  To do this go to Tools -> Transform Tools -> Perspective. Move the guide bars to the edge of the building in order to ensure that the resulting image is straight.  Click and drag the corner of the image until the image distorts enough to straighten the sides of the building.  Do the same thing on the other side of the image (see screenshot below).
  5. Crop the image to remove the empty space which resulted from the stretching of the image.  To do this, draw a rectangle around the area which will be the new image outline.  Click on Image -> Crop to Selected.
  6. Remove the guide bars and survey the result of your changes (Image -> Guides -> Remove All Guides).
  7. Make sure that the composition of the image is still good after the crop.  For example, after I cropped my image, you could still see half of the Canadian flag on the left side.  Use image editing tools to clear up any stray items within the picture.

Straightened image before cropping with guide rulers

Using Photoshop:

  1. Load image.
  2. Add guides by grabbing at the ruler and dragging to the image.  The guides help make sure that the building lines are straight while you do your adjustments.
  3. Rotate the canvas if necessary to straighten the image. To do this, go to Image -> Rotate Canvas -> Arbitrary Rotation -> adjust the angle to make the image straight then click 'rotate'. Use a horizontal guide bar to help make the image straight.
  4. Adjust the perspective of the image to straighten the edges of the building.  To do this go to Filter -> Distort -> Lens Correction -> Vertical Perspective. Move the guide bars to the edge of the building in order to ensure that the resulting image is straight.  Click and drag the corner of the image until the image distorts enough to straighten the sides of the building.  Do the same thing on the other side of the image.
  5. Crop the image to remove the empty space which resulted from the stretching of the image (see screenshot below).  To do this, draw a rectangle around the area which will be the new image outline.
  6. Remove the guide bars and survey the result of your changes.
  7. Make sure that the composition of the image is still good after the crop.  For example, after I cropped my image, you could still see half of the Canadian flag on the left side.  Use image editing tools to clear up any stray items within the picture.

As you can see, the process is essentially the same in both programs.  See below for a comparison between the original image and the resulting image with the perspective corrected.

Original image

 

The image above is the original image of the Scotiabank Place taken in Ottawa, Ontario.  As you can see, the image is slightly crooked and the walls of the building tilt inward towards the top.  The image below is the result of an image perspective correction done in the GIMP - a free image editing software.

Straightened image

Tags: