Sign up now! · Forgot password?
RSS/Atom feed Twitter

Softlight blend mode formulas [was: Image processing algorithms resources]

This discussion is connected to the mailing list which is provided by the GIMP developers and not related to

This is a read-only list on so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

Softlight blend mode formulas [was: Image processing algorithms resources] yahvuu 30 Jul 22:00
2012-07-30 22:00:22 UTC (almost 6 years ago)

Softlight blend mode formulas [was: Image processing algorithms resources]

hi again and sorry for the ultra-late answer. I'm putting this back on the list so it can be found in the archives.

Am 08.07.2012 17:14, schrieb Calculemus:

I am still confused though, how do I make a decision on which formula to use for soft-light for example? Can I pick the "best" one, or there is no best one and it does not matter which one I pick?

In short: it doesn't matter much, the various softlight modes produce quite similar results.

In bullet points: - It is a good idea to adhere to the industry standard photoshop [3] - It is a good idea to adhere to the open industry standard SVG [8] - GIMP does neither, it uses the 'pegtop' formula [4,9] -- and does so whithout problems - The best formula is the one [5] -- in theory, for some sense of 'best'

In full glory: the subtle differences in the softlight modes can be explained by looking at the ideas behind the formulas. In my regard this is an exercise of mere academic interest since the artistic needs for a softlight blend mode are satisfied by any of the formulas. I'm happy to be proved wrong here, though.

Regarding notation, i'll follow the conventions given in [1]: the variables a and b represent the values of the base layer and the blend layer, in that order. The values are in the range [0..1].

The original motivation behind the photoshop formula [3] is presumably to allow for local gamma correction: where the blendlayer value b is a mid gray of b=0.5, the result is identical to the base layer's value a. Lower values of b result in darking the image, up to b=0 which corresponds to a gamma correction with gamma=0.5. Brighter values of b give brighter results, up to b=1 which corresponds to gamma correction with gamma=2.

The photoshop formula has a downside: The way the formula switches between the brightening and the darkening case results in a certain kind of discontinuity in the graphs which has been illustrated in the pegtop article [6]. The corresponding 'gradient angle' diagram in [2] also displays a discontinuity around b=0.5. In theory, this discontinuity results in suboptimal properties regarding the transfer of blend layer midtone texture to base layer highlights and shadows.

The pegtop formula [4] successfully avoids this discontinuity and improves local contrast transfer properties (in theory). However, it breaks the symmetry between darkening and brightening curves: b=1 does not result in gamma correction anymore, while b=0 still corresponds to gamma=0.5. This can best be seen by comparing the 'curves' diagrams in [2].

The ilhu formula [7] resolves the discontinuity in the photoshop formula in a more elegant way, keeping the symmetric gamma correction properties. Another difference from the photoshop formula is that ilhu provides a gamma curve for any value of b, not just for the extrema b=0 and b=1 as the photoshop formula does (not counting the neutral case for b=0.5)

Now interestingly, the SVG formula [8] (which has not been examined in the blog article) follows the photoshop math but introduces a special case when brightening the shadows of the base layer: for b>0.5 (blending effect is brightening) and am short on references for the motivation of this modification. On a general note, i think that blend mode formulas are not a good place to compensate for any weaknesses of a given color representation.


[1] [2] [3] softlight_ps in table [2]
[4] softlight_pt in table [2]; formula taken from [6] [5] softlight_ilhu in table [2]; formula taken from [7] [6] [7] [8] [9]