Using the distortion tool

Photo Ninja includes a simple alignment tool for setting the lens distortion sliders. You simply place control points of the tool along a distorted edge in the image, then click a button to correct the distortion.

To activate the tool, go to the "Distortion and geometry" filter panel and click on "Show tool":

Next, drag the endpoints of the tool to the endpoints of a distorted edge in the image. Ideally, the edge should be far away from the center and should be as long as possible. The edge should also be oriented tangentially to the center -- that is, it should run along the edge of the image rather than through the center:

Zoom in and place all the anchor points of the tool directly on the edge:

Click the "Auto align" button to correct the distortion:

On images with fisheye or other complex distortion, you might get better results by placing two or three instances of the alignment tools on different edges in the image. This will help to average out small placement errors of individual points. To add another instance of the tool, click the "+" button: