What Causes Lens Distortion
Lens distortion is a common phenomenon in photography that typically occurs when using wide-angle lenses to capture photos. A wide-angle lens, to put it simply, is a lens with a shorter focal length that allows you to capture a wider area in your photo. Wide-angle lenses are more commonly used in landscape and architectural photography because of their ability to capture greater areas of a scene (and thus capture wider/taller objects like large buildings or mountains).
Wide-angle lenses will typically be 35mm or smaller. So, a 15mm lens will be a wide-angle lens, while a 50mm lens will be a “normal” lens.
Wide-angle lenses are a great way of capturing more of your surroundings, especially when you are shooting in small spaces and don’t have much room to back your camera up. Because these lens types utilize glass that is heavily curved in order to capture wider areas, they tend to produce lens distortion that sometimes (but not always) requires correcting in a photo editor such as GIMP.
The lens distortion itself will happen around the edges of your photograph since that is where the glass in your lens is curving the most. Objects towards the center of your photograph will usually contain far less lens distortion. The further out you go from the center of a photo taken with a wide-angle lens, the more distortion will start to occur.
Types of Distortion
The type of distortion created by wide-angle lenses is called negative distortion. This type of distortion, which also goes by the name barrel distortion, occurs when the elements along the edge of the image tend to appear bowed inward. The reason your images will create this type of distortion is that camera lenses are concave – they curve inward. The curving of the glass of your lens distorts the edges of your photos – curving them in the same manner.
This is as opposed to positive distortion, also called pincushion distortion, which occurs when elements along the outer edges of your photograph appear bowed outward. Your images won’t have this type of distortion because your camera lens would have to be convex, or curving outward, in order to create this type of distortion. However, it is important to understand this distortion type as it is utilized in order to correct the negative distortion created by your camera since it bends your photos the opposite way.
How to Correct Lens Distortion in GIMP
Now that you have a basic understanding of what lens distortion is and how it is caused, we can now dive into how to correct lens distortion in GIMP.
I’d like to start by pointing out that photos taken with a wide-angle lens don’t always need to have the lens distortion corrected. In a lot of cases, you may want to keep the distortion in order to exaggerate the distance between a foreground object and background object, for example, or to make objects look more distant.
However, there are also plenty of cases where you would want to correct lens distortion. For example, you may have wanted to capture more area of a tight space, but didn’t want the objects captured in your photograph to look warped or distorted in the final photo. This can be especially true when photographing a person, as the distortions may produce unflattering final results.
For this tutorial, I’ll be using a photo I took that features both a model and a tight space. I took the photo with a Tokina 11-16mm f/2.8 wide-angle lens on a Canon 7D. In the photo, there is negative distortion occurring around the outer edges of the photo. You can download the photo for free on my Flickr page and follow along. To open the file in GIMP, simply go to File>Open and select the image file from your computer.
Identify the Distorted Elements
It helps to be able to identify what elements exactly are being distorted in a photo. The easiest place to start is by finding lines that should be straight – like a horizon line or a piece of straight furniture such as a table top. In the case of this photo, my model is sitting on a table. The lines created by the table should be straight for the most part, but because of the lens distortion they have become curved.
To highlight just how curved parts of this table are, I dragged two guides onto my composition – one vertical placed at the center of my image, and one horizontal place along the bottom edge of my table (denoted by the green arrow) – and then drew a line along the curved edge of my table using the paths tool (don’t worry about creating this curve yourself – usually you can just eyeball it – I am merely drawing the path to make it easier for you to see).
When I create a stroke along this path, you can see just how curved the bottom portion of the table really is. Of course, because it is so close to the bottom of the frame (and thus the bottom of the lens), this object will be much more distorted than objects closer to the center of our frame.
Besides the straight lines in our photo, there are also plenty of other elements that exhibit lens distortion. In this case, the vases next to our model as well as the lights above the model have noticeable distortion (circled in red in the photo above).
When fixing lens distortion in our photo, it’s important to keep in mind that we don’t need to totally correct the distortion and make everything perfectly straight. We simply want to correct some of the distortion by a reasonable amount to mitigate some of the distorting that’s occurring.
Now that we’ve identified the main elements of the photo that contain distortion, we can now move on to fixing these areas to help improve the appearance of the photo.
Use the Lens Distortion Filter
I’ll start the correction process by first duplicating our Original Photo layer (click on your image layer in the layers panel, then click the “Duplicate” icon – denoted by the red arrow in the photo above). I’ll rename the duplicate layer by double-clicking the layer name in the layers panel (green arrow) and typing “Corrected Photo.” This is the layer we will use our filter on.
If you aren’t totally familiar with working with layers, I recommend checking out my E-book “GIMP Book of Layers.”
Next, I’ll make sure I am clicked on the Correct Photo layer, and will then access the Lens Distortion filter by going to Filters>Distorts>Lens Distortion (red arrow). When hovered over this option with your mouse pointer, you’ll see that the filter “Corrects barrel or pincushion lens distortion.” These are the two types of distortions I discussed earlier in this article.
Once the Lens Distortion filter is open, you will see 6 different sliders (denoted by the green bracket in the photo above).
The “Main” slider adds or removes second-order distortion. In other words, it adds or removes spherical distortion occurring within the main area of your image (from just outside the center of your image to the outer edge of your image). If I click and drag the slider to the right using my mouse (red arrow in the photo above), this will produce a more concave result – making your photo bend away from the viewer or more towards the center of the photo.
On the other hand, if I drag the slider to the left (red arrow), this will produce a more convex result – or cause the photo to bend towards the viewer or away from the center of the image. This will decrease the amount of negative distortion in our photo by adding positive distortion. (Yes, you read that right – a negative slider value creates positive distortion).
Since our photo already has negative distortion, we’ll want to make sure the Main slider has a negative value to correct this. In this case, a value of somewhere between -7 and -9 produces a decent result. Ultimately, though, for your images, your final slider value will be up to your discretion and depend on several factors in your photo (i.e. what lens you used, how close objects were to you and the corners of your lens, etc.). You can see the bottom line of our table already looks quite straight after performing this correction (red arrow in the above photo).
The “Edge” slider adds or removes forth-order distortion. In other words, it adds or removes spherical distortion occurring within the outer edge of your image. So, this slider does not correct distortion occurring closer to the center of the photo – only the far outer areas of the photo.
Similar to the Main slider, setting a positive value on the Edge slider (red arrow in the above photo) will cause the outer edge of your photo to bend inward towards the center of the image and away from the viewer.
Conversely, setting a negative value on the Edge slider (red arrow in the above photo) will cause the outer edge of your photo to bend outward away from the center of the image and towards the viewer. In this case, because I cropped the far-outer edges of this photo out during the photo adjustment process I conducted prior to the start of this tutorial, the image doesn’t need any adjustments to the Edge (in my opinion). It is fairly common, however, that the far edges may required a slightly negative adjustment – especially when using lenses on the shorter end of the wide-angle lens spectrum (i.e. 10mm lens).
Next up is the Zoom slider. This feature allows you to adjust the framing of your photo by zooming towards or away from the center of the image. This feature comes in handy when you’ve added a negative distortion to your photo (i.e. set the Main or Edge slider to a positive value) because this can sometimes cause the photo’s adjusted boundary to shrink, revealing a solid color background around the edges.
For example, if I set the “Edge” slider to somewhere around 20, you’ll now see a black background filling in the corners and sides of the image where the image has become smaller than the layer boundary (red arrows in the above photo).
Now, if I set the Zoom slider value to somewhere around 9 or 10 (red arrow in the above photo), I’ll be zoomed in enough to hide those areas where the background color is showing. The down side to this is that you’ll be cropping out parts of your photo, and will also lose image quality since the image has to scale up in order to fit the zoom window.
On the other hand, if I set the Zoom slider to a negative value (somewhere around -20, denoted by the red arrow in the above photo), this will zoom the image out and reveal more of the background color (green arrows). I want to point out while we are zoomed out that you can see why this type of distortion is called “barrel distortion.” The shape of the frame of the photo resembles that of a barrel.
I’ll keep the image zoomed out in order to also demonstrate how the frame of the image looks when it has the “pincushion distortion” added to it – or in other words I’ll set the “Edge” slider to a negative value. In this case, you can see that the edges of the image (red arrow in the above photo) spread way further out than the sides of the image (green arrow). This shape is indicative of images that contain pincushion distortion.
I’ll set my Edge and Zoom sliders back to zero and will now move on to the next sliders.
Shift X/Shift Y
The Shift X and Shift Y sliders allow you to offset the Lens Correction effect on the X or Y axis of your image. So, rather than the effect applying to the center of the effect moving outward as it does by default, you can have the effect start slightly to the left or right (for the Shift X slider) or slightly above or below the center of the image (for the Shift Y slider).
These sliders are effective in certain cases – like when you take a picture from an angle, creating uneven distortion throughout the image. For example, if you take a photo from a low position looking up and to the right, you may experience more distortion in the bottom left corner of the image than the top right of the image.
Giving the Shift X slider a positive value (red arrow in the photo above) shifts the Lens Distortion effect to the right of center.
On the contrary, giving the Shift X slider a negative value (red arrow in the photo above) shifts the effect to the left of center. The effect can be subtle when looking at the above image, but if you use your mouse pointer to move the Shift X slider all the way to -100, then all the way up to 100, and continue going back and forth, you will see how the effect shifts across the photo based on the value set for the Shift X slider. Additionally, the effect will be noticeable when your Main or Edge slider is turned up significantly. The Shift X and Shift Y sliders both will not work unless you have non-zero values for the Main/Edge sliders.
Similarly, when the Shift Y slider has a positive value, it shifts the effect above the center of your image, and when it has a negative value it shift the effect below the center of your image.
I’ll keep the Shift X and Shift Y sliders set to 0 for now and will move on to the next option.
The final slider for the Lens Distortion filter is the “Brighten” slider. This slider corrects something called vignetting. Vignetting is a darkening of the corners of the image caused by light absorption differences. These light absorption differences occur because of the curvature of the glass of your lens – the edge of your lens (where the glass curves the most) takes in light differently than the center of your lens.
When the Brighten slider is set to a negative value by dragging it to the left (red arrow in the above photo), the edges of your corners will get darker (similar to when using the Vignette filter in GIMP).
When the Brightness slider is set to a positive value by dragging it to the right (red arrow in the photo above), the edges of your corners will get brighter. You’ll want to use a positive value for your Brightness slider to reduce the vignetting caused by lens distortion as your corners are typically made darker by this phenomenon.
I don’t want to brighten the corners too much as it will make the photo look overexposed on the edges. For this photo, I’ll set the slider to around 20.
Below the sliders is the “Background color,” which gives you an option to change the color that displays behind your photo when you add a negative distortion (barrel distortion) by giving the Main or Edge sliders a positive value (as we did earlier in the tutorial).
The default is set to black, but you can change the color to any color you’d like by clicking on the color rectangle (red arrow in the photo above) and using the Background color dialogue box (highlighted in green), or using the adjacent eyedropper tool to select a color from your image.
Once you have all of your settings the way you want them, click the “Ok” button to apply your changes.
Your “Corrected Photo” layer will now have the lens distortion corrected – making the objects in the photo appear less distorted and the brightness of the corners of the image matching the brightness of the rest of the image.