GIMP Feather Radius and Linear Falloff Explained
In GIMP, the feather radius setting softens the boundary of a selection by replacing hard, binary edges with a progressive gradient of transparency. This article explains how GIMP uses the feather radius to calculate the linear falloff zone, detailing how spatial distance from the selection boundary maps to opacity values in the underlying selection mask.
The Underlying Selection Mask
In GIMP, a selection is not merely a coordinate boundary; it is stored as an 8-bit or floating-point grayscale channel known as a selection mask. In this mask, an intensity value of 255 (or 1.0 in floating-point precision) represents a fully selected pixel, while a value of 0 represents an unselected pixel. Any value between 0 and 255 represents partial selection, which translates directly to partial opacity when performing edits, fills, or deletions.
Defining the Transition Zone
When you feather a selection, the feather radius parameter defines the spatial reach of the softening effect measured in pixels.
The original, unfeathered selection edge acts as the baseline (the 50% opacity midpoint). Rather than applying the blur entirely inside or entirely outside the selection, GIMP distributes the falloff symmetrically across this border. A feather radius of \(r\) establishes a transition band that extends \(r\) pixels inward toward the center of the selection and \(r\) pixels outward into the unselected canvas. This results in a total transition zone width equal to \(2r\) pixels.
The Distance Transform and Linear Calculation
To calculate a linear falloff across this \(2r\) window, GIMP evaluates the Euclidean distance of each pixel relative to the original border vector:
- Euclidean Distance Measurement: For any pixel within the transition zone, the algorithm computes its shortest perpendicular distance (\(d\)) to the original selection boundary.
- Normalized Position: This distance is assigned a signed value where distances inside the selection are positive (\(+d\)) and distances outside are negative (\(-d\)).
- Linear Mapping Function: The mask value (\(\alpha\)) is computed linearly based on where the pixel falls within the range \([-r, +r]\):
\[\alpha = \frac{d + r}{2r}\]
When scaled to an 8-bit channel (0 to 255):
- At \(d = -r\) (the outer boundary of the falloff zone), \(\alpha = 0\), meaning the pixel is completely unselected.
- At \(d = 0\) (the exact original vector line), \(\alpha = 0.5\), yielding a mask value of 128 (50% opacity).
- At \(d = +r\) (the inner boundary of the falloff zone), \(\alpha = 1.0\), yielding a mask value of 255 (fully selected).
Sub-Pixel Sampling and Anti-Aliasing
Because selection borders rarely align perfectly with the square pixel grid, GIMP calculates distances using floating-point sub-pixel coordinates. For pixels that straddle the edge of the feather radius, the software samples the area coverage to prevent stepping artifacts (aliasing). The resulting continuous rate of change across the \(2r\) span produces an even, straight-line slope in mask density, ensuring that image adjustments blend seamlessly into surrounding areas without visible seams.