How to add lens distortion to an AI image

Real lens distortion is radial: zero at the optical centre and growing with distance, bending straight lines near the edges. Barrel distortion bows lines outward, pincushion pulls them inward. Add it with a lens correction filter or a radial remap, keep the coefficient tiny, crop the empty corners, and avoid the strong fisheye look that reads as an effect.

Last updated: 2026-10-27

Naturalization before and after, full frame on both sides and the most textured region enlarged twice to show the grain structure
Source: ai-sd15-how-to-add-lens-distortion.png, 512×512. After: JPEG, Apple iPhone 14 EXIF, Apple (mesurée) quantization table. SSIM 0.8532, PSNR 25.1 dB. Full image on both sides, then the same detail at 100 % zoom and 200 % zoom.

Why bother with distortion

Every real lens bends the image a little. Straight lines near the border curve outward or inward depending on the design, and the bend increases smoothly with distance from the centre. Software in modern cameras and phones corrects much of it, but not all, and a trained eye still picks up the residue on architecture.

A generated image has no lens. Its straight lines are mathematically straight, unless the model itself drew a wobbly one. Adding a faint radial bend is one way to give geometry some of a lens's character. It is a styling choice, not a cure for anything, and it works best on pictures that contain long straight edges.

The maths in one paragraph

Distortion is usually modelled by scaling each point by a polynomial of its distance from the centre. If the radius is r, the new radius is r times one plus k times r squared, with k a small coefficient. Negative k gives barrel, positive gives pincushion. Nothing happens at r equal to zero, which is why the centre stays still. Higher-order terms refine the curve, but one coefficient is plenty for a subtle effect.

In GIMP

Open Filters, Distorts, Lens Distortion. The Main slider controls the radial term. Values of roughly five to ten in either direction are already clearly visible on a large image, so start lower than you expect and zoom in on a straight edge. Leave Edge, Zoom and the brighten setting alone at first. After applying, crop to remove transparent corners.

In Photoshop

Use Filter, Lens Correction, then the Custom tab. The Remove Distortion slider works in both directions: a negative value pushes toward barrel and a positive value pulls toward pincushion on most versions, though the sign convention varies, so check the preview. Turn on edge handling that crops or extends the border so you do not end up with empty corners.

In Python

OpenCV can remap points with a distortion model, and a short NumPy script does the same with a polynomial of the radius. The workflow is: build a grid of output coordinates, normalise them to the frame centre, compute the source coordinates with your coefficient, and sample the image with bilinear or bicubic interpolation. Choose a high-quality interpolation, because a weak one softens the whole frame.

Pitfalls

Where it fits in a full workflow

Geometry first, then colour fringing, then grain, then compression and metadata. That order mirrors a real camera: optics, sensor, processing, file.

PassReal covers the later stages. It strips C2PA, IPTC digital source type, XMP and PNG text chunks, applies grain and radial chromatic aberration that is zero at the centre, low-pass filters the spectrum and writes a JPEG with real-camera EXIF. It does not add geometric distortion, and it does not remove SynthID or any pixel-level watermark.

Checking your result

Print a grid in your head: find the longest straight edge nearest a border, such as a door frame or a skyline, and hold a ruler against the screen. A faint curve that you only notice with the ruler is the right amount. If you see the curve without it, undo and halve the coefficient. Also compare against a real photograph taken at the focal length you claim, because wide phone lenses and portrait lenses distort in opposite ways. Finally, remember that software correction in modern cameras flattens most of this, so restraint is more realistic than strength.

Try it

Distort your image lightly, then process three images free at PassReal to finish the sensor and file stages.

What is checkedValue
Accepted formatsPNG, JPEG, WebP
Maximum size20 MB
Maximum dimension8192 px on the longest side
Sensor grain intensity0.018
Lateral chromatic aberration1.25 px at the corners, none at the centre
Frequency cutoff0.88 of Nyquist

Questions

Barrel or pincushion?

Wide lenses on phones and compacts tend toward barrel distortion, while telephoto lenses tend toward pincushion. Choose the one that suits the focal length you claim in metadata.

How strong should it be?

Barely visible. Modern cameras correct most distortion in software, so what remains is subtle. A visible bend is a sign of an edit or of a deliberate wide-angle look.

Does distortion affect AI detection?

It alters geometry, not the sensor statistics or the metadata. We make no claim that it changes a detector's result.

Is lens distortion the same as chromatic aberration?

No. Distortion bends geometry, while lateral chromatic aberration shifts colour channels slightly apart toward the edge. Both are radial, and both are zero at the centre.

Does PassReal add lens distortion?

It applies radial chromatic aberration, not geometric distortion. Add distortion yourself before processing if you need it.

Limits

Naturalization operates on the pixels and on the file, not on the content of the image. A subject that is implausible - six fingers, inconsistent reflections, text that does not read - stays implausible after processing, and a human reviewer will notice it. PassReal changes what a statistical classifier measures, not what a person sees.

Results vary by generator, by subject and by detector, and detectors are retrained. No pass rate is published on this page because none has been measured in a way that would still hold next month.

Clean an image in seconds

Three images free, no card. Then $2 an image, or Pro at $19 a month for 100.