ImageEffectsLensBokeh
Real blade-shaped bokeh, not just a fat blur
- images
- IMAGE
A plain Gaussian blur smears highlights into soft discs, but real camera bokeh comes from the shape of the lens aperture - that's why out-of-focus lights in photos are pentagons or hexagons, not circles. ImageEffectsLensBokeh from the Allor plugin is the node that reproduces that: you pick the number of aperture blades and it shapes the blur kernel accordingly. If you're chasing photorealism on a background, this is the difference between "blurred" and "shot on a real lens."
How it works
The node builds a polygon kernel from your blades_shape (3 and up - 5 gives you the classic pentagon), blades_radius (how big the aperture polygon is), and blades_rotation (0–360, to orient it). That polygon is turned into a blur kernel, sharpened slightly with a laplacian-style edge boost, and applied with one of two methods:
dilate- uses OpenCV dilation with the shaped kernel. Fast, and it preserves the aperture shape strongly.filter- a proper filter-2D convolution with the normalized polygon kernel. Softer, more authentic falloff, and it pre-dilates the image slightly to keep highlights round.
You can also run a pre-blur with blur_type (bilateral, stack, or none) at blur_size strength, which smears the detail first and then applies the shaped bokeh on top - that's the combination that reads as "long-lens background."
Inputs that matter
images- the IMAGE or batch to process.blades_shape- number of aperture blades; 5–6 looks the most "real lens." Default 5.blades_radius- aperture polygon size; bigger = chunkier bokeh discs.blades_rotation- rotate the aperture so the shapes don't look perfectly axis-aligned.blur_sizeandblur_type- the pre-blur.bilateral+stackare the realistic options;noneleaves the hard edges in place.method-dilateorfilter; tryfilterfirst for smoothness.
Output is a single IMAGE, same size as the input.
Installing it
It's part of the Allor pack, one install for everything:
cd ComfyUI/custom_nodes
git clone https://github.com/Nourepide/ComfyUI-Allor
Restart ComfyUI (or use ComfyUI Manager → search Allor Plugin). First launch installs rembg and onnx from requirements.txt - slow once, then done. No models needed for this node.
Gotchas
- This is CPU-bound OpenCV work, and
filtermode with a bigblades_radiuscan get slow on high-res images. Start at the defaults and raiseblades_radiusonly if the bokeh reads too weak. - For a proper look, run the pre-blur first - bokeh applied to a sharp image just looks like a shapes filter.
blur_typestackis a good default. - Same pack-wide warning as all Allor nodes: the repo history was rebased, so old clones can hit
git pullfailures. Re-clone if auto-update breaks.
If you want edge darkening to go with it, ImageEffectsLensVignette from the same pack is the natural companion.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| blades_shape | INT | 5 | — |
| blades_radius | INT | 10 | — |
| blades_rotation | FLOAT | 0.000–360 | — |
| blur_size | INT | 10 | — |
| blur_type | COMBO | 3 options: bilateral, stack, none | |
| method | COMBO | 2 options: dilate, filter |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |