Chromatic Aberration
Lens fringing, the lazy way
- images
- images
Chromatic aberration is the color fringing you see at the edges of a cheap lens - red bleeding one way, blue the other, green holding center. It's usually a flaw, and it's also one of the best cheap "analog" tells there is: a touch of it makes a digital render read as shot on glass, and a heavy dose is a staple of VHS and glitch looks. This node does exactly that - it shifts the Red and Blue channels in opposite directions while leaving Green in place - and it does it purely in PyTorch, so it runs on the GPU across an entire video batch without a single ffmpeg round-trip.
That last part is the real selling point. A lot of effects like this get piped through ffmpeg and back, which costs you a decode/encode cycle and the quality loss that comes with it. This one is tensor math: frames in, frames out, fast, and it works on any batch size.
How it works
Each channel is sliced from the image tensor, shifted by the shift amount (in pixels), and padded on the vacated edge with zeros - no wrap-around artifacts, so the fringe looks like a lens, not like a texture that slid around the globe. The three channels are re-stacked and clamped to [0, 1]. Green is never moved, which keeps luminance roughly centered and the fringe reading naturally.
The author gives you the ffmpeg equivalent for reference - rgbashift=rh=8:bh=-8 - which is a useful sanity check if you've seen that filter before. But you don't need it; the node replaces it.
Inputs and output
images- a single image or a batched video sequence.shift- pixel offset per channel, 0–300, default 8. The tooltip is the author's own: "Pixel distance each colour channel is offset from centre." Subtle looks live around 1–3px; 8px is a visible glitch-fringe; past ~20 you're in deliberate VHS territory.direction-Horizontal,Vertical, orDiagonal. Diagonal combines both axes.red_leads- which way Red shifts; Blue always mirrors it. The four options areRed right / Blue left,Red left / Blue right,Red down / Blue up,Red up / Blue down. The tooltip notes that in Diagonal mode the first horizontal + vertical pair is used.
Output is images, same shape as the input. It also handles RGBA - alpha is preserved when present.
Installing it
One of the ~25 nodes in the Simple Video Effects pack:
cd ComfyUI/custom_nodes
git clone https://github.com/scofano/ComfyUI-Simple-video-effects
cd ComfyUI-Simple-video-effects
pip install -r requirements.txt
Restart ComfyUI, or use ComfyUI Manager and search "Simple Video Effects". No models, no downloads.
Common issues
This node is about as foolproof as they come, so the issues are taste, not mechanics. The trap is cranking shift - at high values the colored edges become obvious bands rather than a lens fringe, and zero-filled edges show up as dark/colored borders on the frame edge. If you're going for realism, stay in the 1–4px range; reserve the big numbers for the glitch aesthetic. Also note this is a per-frame effect - frames are shifted identically, so on a moving video the fringe stays locked to the image rather than shimmering like a real lens. For most purposes you won't notice; for a hyper-real shot, that's the giveaway.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| shift | INT | 80–300 | Pixel distance each colour channel is offset from centre |
| direction | COMBO | Horizontal | 3 options: Horizontal, Vertical, Diagonal |
| red_leads | COMBO | Red right / Blue left | Which side each channel shifts toward (Diagonal uses the first horizontal + vertical pair) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |