How to Create Square Bokeh Using Box Blur
The box blur filter is a digital processing tool primarily used in creative photo manipulation to produce distinct, geometric square bokeh effects. While traditional in-camera bokeh produces round or polygonal highlights based on the shape of a physical lens aperture, image editing software can emulate a square aperture using algorithms. This article explains how the box blur algorithm functions, why it naturally creates square-shaped light artifacts, and how to effectively apply it to isolate highlights and generate stylized out-of-focus backgrounds.
The Mechanics of the Box Blur Filter
In digital image processing, a blur filter works by recalculating the color value of each pixel based on the values of surrounding pixels. Most common blurs, such as Gaussian blur, use a weighted average that assigns more importance to pixels closer to the center, resulting in smooth, circular gradients.
A box blur, by contrast, operates on a square grid known as a kernel. It calculates the direct mathematical average of all pixels inside that square window, giving equal weight to every pixel within the boundary. Because the sampling area is inherently a square with sharp boundaries, any intense, isolated point of light passing through the filter is expanded into a uniform square shape.
Simulating a Square Aperture
In physical photography, bokeh occurs when points of light in an out-of-focus plane take on the geometric shape of the camera's aperture blades. Photographers sometimes achieve custom bokeh shapes by placing cutout masks over their lenses.
In post-processing, the box blur filter serves as the digital equivalent of a square aperture mask. When applied to bright specular highlights—such as city lights, sunlight reflecting off water, or fairy lights—the box blur transforms those circular light discs into clean, sharp-edged squares. This gives images an avant-garde, retro, or stylized architectural aesthetic that standard camera optics cannot achieve on their own.
Practical Workflow for Square Bokeh
Applying a box blur directly to an entire photograph often leads to an unappealing, low-fidelity blur across midtones and shadows. To create realistic and visually striking square bokeh, editors typically use a multi-step technique:
- Duplicate the Target Layer: Create a duplicate of the base image to separate the background elements from the foreground subject.
- Isolate the Highlights: Use a luminosity mask, threshold adjustment, or levels adjustment on the duplicated layer to eliminate dark and midtone areas, leaving only the brightest light sources visible against black.
- Apply the Box Blur: Set the box blur radius to determine the size of the square bokeh. A higher pixel radius produces larger squares, mimicking a wider aperture and a shallower depth of field.
- Blend the Highlights: Change the blend mode of the blurred layer to "Screen," "Linear Dodge (Add)," or "Lighten." This removes the black background and seamlessly overlays the illuminated square shapes onto the scene.
- Mask the Foreground: Paint away the blur effect from the primary subject using a layer mask to keep the subject sharp while leaving the background populated with square bokeh.
Aesthetic Applications
The box blur's square bokeh is widely used in digital art, sci-fi concept design, and creative portraiture. It introduces structured, modern geometry into backgrounds that would otherwise appear soft and naturalistic. By utilizing the mathematically square nature of the box blur kernel, editors have full creative control over the size, intensity, and placement of unique geometric highlights.