Nodes/ComfyUI-Image-Effects/๐Ÿ Barrel Distortion
ComfyUI Node

๐Ÿ Barrel Distortion

Give Your Image Lens Character โ€” or Undo the Barrel Bend Your Phone Added

By orion4dยทCreated about a year agoยทUpdated about a year agoยท 28
๐Ÿ Barrel Distortion
  • image
  • IMAGE
โ—„k10.20โ–บ
โ—„k20.00โ–บ
โ—„k30.00โ–บ
โ—„center_x0.50โ–บ
โ—„center_y0.50โ–บ
โ—„scale1.0โ–บ

Barrel Distortion is the lens effect where straight lines bow outward like the sides of a barrel - and its cousin, pincushion distortion, bows them inward. You'll want this node for two opposite jobs: either adding that slight wide-angle wobble to a too-clinical render, or fixing a real photo that already has it baked in from a phone's ultra-wide lens. Distortion is one of those "AI images don't have it unless you add it" tells, so a touch of it can actually make a synthetic image read more like it came out of a real camera.

It lives in the pack's Deformation category, which also has Fisheye, Ripple, Spherize and Pinch. Barrel is the subtle member of that family - fisheye is the show-off.

How it works

The math is the standard polynomial lens model: for each output pixel, the node computes a normalized radius from the distortion center, then remaps the image with cv2.remap using radial coefficients k1, k2, k3 (the classic Brownโ€“Conrady coefficients, minus the tangential terms). Positive k1 pushes pixels outward - barrel. Negative k1 pulls them inward - pincushion.

It uses bilinear interpolation and BORDER_REFLECT, so edges don't go black and the effect stays smooth. Because it's a pure remap, it doesn't resample quality into the image the way a blur would; the result stays sharp.

The inputs that matter

  • k1 (โˆ’1 to 1, default 0.2) - the primary coefficient. Positive barrels, negative pinches. This is the only one 90% of people ever touch.
  • k2 / k3 (default 0) - higher-order corrections. For correcting real lens distortion you may want a small k2 to clean up the residual curve; for adding character, leave them at 0.
  • center_x / center_y (default 0.5) - where the distortion pivots from. Shift it off-center for an off-axis lens look.
  • scale (0.1โ€“2, default 1) - compensates for the empty space barrel distortion leaves at the corners; bump it past 1 when you push k1 hard.

Output is the warped IMAGE, ready to feed a Preview or Save node.

Installing it

From ComfyUI-Image-Effects (Orion4D). Use ComfyUI Manager โ†’ search "Image Effects", or:

cd ComfyUI/custom_nodes
git clone https://github.com/orion4d/ComfyUI-Image-Effects
cd ComfyUI-Image-Effects
pip install -r requirements.txt

Restart ComfyUI and grab it under Add Node โ†’ Image Effects. Nothing extra to download - the pack's dependencies are NumPy, OpenCV, Pillow and SciPy.

Gotchas

The usual pack rules apply: it only processes the first image in a batch, and it's CPU NumPy, so a 4K remap takes a moment (still usually under a second). The real trap here is subtle: after a strong barrel correction the image gets stretched toward the corners, so if you're fixing a photo, do it before any crop. And if your goal is "make it look like a real wide-angle shot," pair a mild positive k1 with the Fisheye node's higher field-of-view - barrel alone reads as a geometric trick, not a lens.

CategoryImage Effects

Inputs (7)

NameTypeDefaultDescription
imageIMAGEโ€”
k1FLOAT0.20-1โ€“1โ€”
k2FLOAT0.00-1โ€“1โ€”
k3FLOAT0.00-1โ€“1โ€”
center_xoptFLOAT0.500โ€“1โ€”
center_yoptFLOAT0.500โ€“1โ€”
scaleoptFLOAT1.00.1โ€“2โ€”

Outputs (1)

NameTypeDescription
IMAGEIMAGEโ€”