How to Use the Cage Transform Tool in GIMP

Using the Cage Transform Tool in GIMP

Correcting perspective distortion with the cage transform tool in GIMP.
Correcting perspective distortion with the cage transform tool in GIMP. © Ian Pullen

In this tutorial, I'm going to show you how to use the new Cage Transform Tool in GIMP 2.8. GIMP 2.8 is the latest version of the popular and powerful free and open source image editor. This version has brought a number of improvements to the application and you can read more about these in my review.

One of these improvements is the Cage Transform Tool that introduces a new powerful and versatile way to transform photos and areas within photos. This won't be immediately useful to all GIMP users, though it could be a useful way for photographers to reduce the effects of perspective distortion. In this tutorial, I'm going to use an image that exhibits perspective distortion as the basis of showing you how to use the new tool.

Perspective distortion occurs when the lens of a camera has to be inclined in order to get the whole of a subject in frame, such as a when photographing a tall building. For the purpose of this tutorial, I deliberately induced perspective distortion by getting down low and taking a photo of a door into an old barn. If you look at the image, you'll see that the top of the door appears to be narrower than the bottom and that is the distortion that we're going to correct. While it is a bit of a rickety barn, I can assure you that the door is, by and large, rectangular in reality.

If you've got a photo of a tall building or something similar that suffers from perspective distortion, you can use that image to follow along. If not, you can download a copy of the photo that I've used and work on that.

Download: door_distorted.jpg

Related: Correcting Perspective Distortion with The GIMP

Apply a Cage to the Image

Apply a Cage to the Image
© Ian Pullen

The first step is to open your image and then add a cage around the area that you wish to transform.

Go to File > Open and navigate to the file that you're going to work with, click it to select it and press the Open button.

Now click on the Cage Transform Tool in the tool box and you can use the pointer to place anchor points around the area that you wish to transform. You just need to left click with your mouse to place an anchor. You can place as many or as few anchor points as necessary and you finally close the cage by clicking on the initial anchor. At this point, GIMP will make some calculations in preparation for transforming the image.

If you wish to change the position of an anchor, you can click the Create or adjust the cage option below the Toolbox and then use the pointer to drag the anchors to new positions. You will have to select the Deform the cage to deform the image option again before you transform the image.

The more accurately that you place these anchors, the better the final result will be, though do be aware that the result will rarely be perfect. You may find that the transformed image suffers from alternative distortion and areas of the image appear to overlay oddly on other parts of the image.

In the next step we'll use the cage to apply the transformation.

Related: Anatomy of GIMP

Deform the Cage to Transform the Image

Deform the Cage to Transform the Image
© Ian Pullen

With a cage applied to part of the image, this can now be used to transform the image.

Click on the anchor that you wish to move and GIMP will make some more calculations. If you wish to move more than one anchor simultaneously, you can hold down the Shift key and click on the other anchors to select them.

Next you just click and drag the active anchor or one of the active anchors, if you've selected multiple anchors, until it is in the desired position. When you release the anchor, GIMP will make the adjustments to image. In my case I first adjusted the top left anchor and when I was happy with the effect on the image, I adjusted the top right anchor.

When you're happy with the result, just press the Return key on your keyboard to commit the transformation.

As I said earlier, the results are rarely perfect and to get the most out of using the Cage Transform Tool, you'll also want to get familiar with using the Clone Stamp and Healing tools.

Related: GIMP Tutorials