Reproduced from Scribbles and Snaps by permission of Dmitri Popov.
Lens distortion is a fact of life. You can mitigate this problem, but you can’t avoid it completely (unless you are willing to invest in seriously expensive professional-grade lenses, that is). Fortunately, digiKam provides a set of tools that can help you to fix lens distortion with relative ease. In fact, the application sports the Auto-Correction feature that attempts to fix lens distortion with a minimum of tweaking. So if you have a photo that suffers from barrel or pincushion  distortion, you might be able to fix it quickly using the Auto-Correction tool. To do this, open the photo in the image editor (choose -> or press F4) and choose -> -> . digiKam then automatically pulls the camera, lens, and other relevant information from the photo’s metadata and attempts to fix the distortion based on the obtained data. Besides the lens distortion, the Auto-Correction feature can fix other problems, too, including chromatic aberration and vignetting. So if the photo exhibits any of these problems, you can apply fixes to it by ticking the appropriate check boxes.
Usually the Auto-Correction tool does a decent job of fixing lens distortion, but if it fails to do the job, you can try to fix the problem manually. To do this, choose-> -> and adjust the and sliders to correct lens distortion.