Lens correction

On this page 7

Lens correction is the digital compensation of optical defects in a photograph, most commonly geometric distortion, vignetting and lateral chromatic aberration, based on a mathematical model of the lens that took the image. In image processing within photography, it is applied in the camera to JPEG files or in the RAW converter, either automatically from a lens profile or manually with sliders.

Lens correction exists because every real lens trades some optical errors for size, weight, cost and speed. Modern lens design increasingly relies on software correction as part of the system: many compact mirrorless lenses are designed with significant distortion or vignetting that is expected to be removed in processing, and some of them carry mandatory corrections embedded in the RAW file metadata.

How lens correction works

A lens profile describes how a specific lens deviates from an ideal projection. It is created by photographing calibration targets at several focal lengths, apertures and focus distances, then fitting polynomial models for distortion, brightness falloff and color misregistration. During processing, the software applies the inverse of these models to every pixel.

Each defect is corrected by a different operation. Distortion is fixed by remapping pixel positions radially, vignetting by applying a radial brightness gain, and lateral chromatic aberration by scaling the red and blue channels slightly relative to green so that their edges line up again.

DefectWhat the lens doesHow software corrects it
Barrel distortionStraight lines bow outwardPulls the edges inward by remapping
Pincushion distortionStraight lines bow inwardPushes the edges outward by remapping
Mustache distortionWavy lines, mixed barrel and pincushionHigher-order polynomial remapping
VignettingCorners darker than the centerRadial brightness gain toward the edges
Lateral chromatic aberrationColor fringes increasing toward the edgesRescales red and blue channels
Longitudinal chromatic aberrationPurple and green fringes around focusOnly partial removal by desaturating fringes
Defects addressed by lens correction

Correction normally happens after demosaicing and before sharpening in the processing pipeline. This order matters: sharpening uncorrected chromatic fringes would exaggerate them, and distortion remapping after sharpening would soften the sharpened edges again.

Profile-based and manual correction

There are two main approaches: automatic profiles that match the lens identified in the file metadata, and manual adjustments for lenses without a profile or for creative control. Many workflows combine both.

MethodHow it worksStrengthLimitation
In-camera correctionCamera applies its stored data to JPEG and videoImmediate, no editing neededFixed result, not adjustable for RAW
Embedded RAW correctionsCorrection data stored in the RAW metadataPrecise, made by the lens makerSome converters cannot disable it
Software lens profileConverter looks up the lens modelConsistent across many lensesMissing for rare or adapted lenses
Manual slidersUser sets distortion and vignetting amountsWorks with any lensApproximate, time-consuming
Custom profileCreated by shooting a calibration targetExact for one specific lens copyRequires effort and equipment
Ways to apply lens correction

Profile accuracy depends on how well the profile matches the shooting conditions. Distortion in many zoom lenses changes with focal length and focus distance, so profiles that interpolate between calibrated settings give the best results, while manual correction works well for fixed focal length lenses at a single typical distance.

Some camera makers extend in-camera processing with diffraction compensation, which applies extra sharpening at small apertures based on the known aperture and lens data. This is related to lens correction but is closer to deconvolution sharpening than to geometric correction, and it is typically available only for JPEG files and video.

Lens correction is easily confused with perspective correction and other geometric tools, but they solve different problems. The table separates the concepts that often appear in the same panel of editing software.

AdjustmentProblem it solvesCaused by
Lens correctionOptical defects of the lensLens design
Perspective correctionConverging verticals, keystoningCamera tilt relative to the subject
DefringingResidual purple and green fringesLongitudinal chromatic aberration
SharpeningSoftness from the lens and anti-aliasingOptical blur and demosaicing
Noise reductionRandom pixel variationSensor signal limits
Lens correction and neighboring adjustments

A straight building that leans backward because the camera was tilted upward is not a lens defect, and a lens profile will not fix it. Conversely, perspective tools cannot remove barrel distortion, because the curvature is radial, not planar.

Costs and limitations of digital correction

Digital correction is not free. Removing strong barrel distortion stretches the corners of the image, which reduces effective resolution there and requires cropping the edges, so the final angle of view is slightly narrower than the uncorrected frame. With very wide lenses, this loss can be clearly visible.

Vignetting correction lifts the corners with digital gain, which also amplifies noise. A correction of two stops at the corners raises corner noise by the same amount, which matters at high ISO and in astrophotography. Lateral chromatic aberration correction works well, but longitudinal chromatic aberration cannot be fully corrected because it changes with distance from the focus plane.

Correction also changes the look of a lens. Some photographers deliberately keep vignetting in portraits to draw attention toward the center, or retain mild barrel distortion in fisheye images, where removing it entirely would produce extreme stretching at the edges.

Common mistakes with lens correction

Most problems come from applying the wrong profile or from correcting twice.

  • Selecting a similar but wrong profile, for example a different version of a zoom lens, leaves residual distortion or creates new waviness.
  • Double correction happens when in-camera corrected JPEGs are corrected again with a profile in software.
  • Correcting distortion before stitching may confuse panorama software that models the lens itself.
  • Ignoring teleconverters and adapters, which change the optical behavior and invalidate the original profile.
  • Forgetting to check the corners after correction, where stretching and noise are most visible.

The idea in brief

No lens is perfect. Some bend straight lines, some make the corners darker and some add thin colored edges to objects. Lens correction is the software fix for these small faults.

The editing program knows how each lens tends to misbehave. It quietly undoes those mistakes, much like glasses correct a person’s vision. The photo ends up straighter, more even and cleaner.

A practical scenario

A real estate photographer shoots a small apartment with a 16-35 mm zoom at 16 mm. The RAW files show noticeable barrel distortion, so door frames near the edges bow outward, and the corners are about one and a half stops darker than the center.

In the RAW converter she enables the matching lens profile, which straightens the lines and brightens the corners, then removes chromatic aberration. Next she applies vertical perspective correction for the slightly tilted camera. Walls and doors look straight and the light is even, at the cost of a small crop that she planned for by framing slightly wider.