How to add chromatic aberration to an AI image

Lateral chromatic aberration is a radial colour shift: the red and blue channels are magnified slightly differently from green, so edges toward the corners show thin coloured fringes while the centre stays clean. To add it, scale the red and blue channels by tiny opposite amounts about the image centre. A constant offset across the frame is wrong and looks like a mistake.

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-chromatic-aberration.png, 512×512. After: JPEG, Samsung SM-S928B EXIF, Samsung (mesurée) quantization table. SSIM 0.8425, PSNR 23.9 dB. Full image on both sides, then the same detail at 100 % zoom and 200 % zoom.

What it is

A simple lens focuses different wavelengths at slightly different positions, because glass bends blue light more than red. Lens designers fight this with multiple elements, but a residual always remains. The visible form is a thin coloured edge along high-contrast boundaries, and it is strongest far from the optical axis.

That last point is the whole trick. The effect is radial. On the axis, red, green and blue line up. Toward the corners, red is displaced one way and blue the other. Orientation follows the radius, so on the left edge the fringe shifts horizontally, in the top corner it shifts diagonally, and in the middle of the frame there is nothing.

Why the common shortcut fails

Many editing recipes suggest offsetting the red layer by one pixel and the blue by one pixel the other way. The result is a constant shift across the whole frame. Even the centre, where the lens has none, picks up colour edges. It looks like a misaligned print, and anyone who inspects centre detail sees the error.

The correct operation is a scale, not a shift. Scaling a channel about the centre moves each point by an amount proportional to its distance. That gives zero at the centre and the largest displacement at the corners, which is the real behaviour.

In Photoshop

Split the image into channels, or open Filter, Lens Correction and use the Chromatic Aberration sliders for red-cyan and blue-yellow fringe, which apply a radial correction. Pushing them in the opposite direction from a correction adds the effect rather than removing it. Alternatively, copy each channel to its own layer, transform the red layer a fraction of a percent larger, the blue layer the same amount smaller, anchor at the centre, and set the blend modes to combine them again.

In GIMP

Use Colors, Components, Decompose to RGB layers, then Layer, Scale Layer with the centre anchor, followed by Compose. This takes a few more clicks than Photoshop but gives the same maths.

In Python

Load the image as an array, split the channels, and resample red and blue with an affine transform that scales about the image centre. A scale factor just above and just below one is enough. Use a good interpolation, since a poor one softens those channels and leaves visible colour smearing. Then stack the channels and save.

How to judge it

Placement in a workflow

Colour fringing happens in the lens, so it belongs before the sensor stages. Add grain after, so the noise sits on top of the fringing as it would in a real exposure. Then compress once.

PassReal applies this in sequence: it removes C2PA, IPTC digital source type, XMP and PNG text chunks, adds grain, adds radial lateral chromatic aberration reaching 1.25 px at the corners and none at the centre, smooths the frequency spectrum, and encodes a JPEG with real-camera EXIF.

It does not remove SynthID or any pixel-level watermark, and it does not promise any detector outcome.

Common mistakes

Three errors recur. The first is applying the effect to the whole image equally, which we covered. The second is using a large scale difference so that fringes appear in mid-frame, where real lenses show almost none. The third is blurring the shifted channels, which smears colour into a haze instead of a thin edge line. Keep the interpolation sharp, keep the difference small, and judge only at the corners. A good test is to desaturate the result: if the picture looks identical in black and white and only the corners carry a coloured edge in colour, you got it right.

Try it

Process three images free at PassReal and zoom into a corner of the result to see the fringe grow from nothing at the centre.

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

What is the difference between lateral and longitudinal aberration?

Lateral aberration shifts colours sideways and increases toward the edges. Longitudinal aberration focuses colours at different depths, giving fringes in front of and behind the focal plane. Lateral is what you imitate with a radial channel scale.

Why is a constant shift wrong?

A fixed offset moves colours the same amount everywhere, including at the centre, where a real lens shows none. It looks like a misregistered print, not an optical effect.

How large should the shift be?

A pixel or so at the corners of a large image is already visible on close inspection. PassReal uses 1.25 px at the corners and zero at the centre.

Does this hide an image from detectors?

No claim is made. It reproduces one physical trait of lenses, among several that a camera file has.

Do I need to do this before or after resizing?

Before the final resize if the amount is defined in pixels at full resolution, and always before compression, so the fringes are part of the encoded picture.

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.