Blend mode math: the four lines behind Multiply, Screen and Overlay
Two layers, one expression, and a branch that most explanations put on the wrong colour. For soft light, the name covers several formulas. The harness asks your browser what it computed, by reading a pixel back through getImageData.
Independent guide. We read published definitions and measured what a browser does. We are not affiliated with Adobe or with the REA project. Nothing here is a Photoshop script, action, or preset.
Findings
From Wikipedia's Blend modes, the Multiply, Screen, Overlay, Hard light and Soft light passages, retrieved 18 Oct 2026. a is the base, b is the blend, both in 0–1.
| Mode | Formula as published | Confidence | What it does not prove |
|---|---|---|---|
| Multiply | f(a,b) = a·b | High | — |
| Screen | f(a,b) = 1 − (1−a)(1−b) | High | — |
| Overlay | 2ab when a < 0.5, else 1 − 2(1−a)(1−b) | High | That the branch is ever taken on b. When it is, the mode has a different name |
| Hard light | the same pair, tested on b | High | — |
| Overlay is not commutative | stated directly | High | — |
| Soft light, Photoshop form as of 2012 | 2ab + a²(1−2b) if b < 0.5, else 2a(1−b) + a(2b−1) | High | Which build changed it, beyond the "as of 2012" framing |
| Soft light, earlier Photoshop form | 2(1−b)a + b when a ≤ 0.5, else (2a−1)(2b−1) | Medium | Whether any current app still uses it |
| Soft light, Pegtop form | (1−2b)a² + 2ba | High | — |
| Soft light, exponential form | a^(2^(0.5−b)), undefined at a = 0, b = 0.5 | High | — |
| W3C / Cairo / earlier PDF form | g(a) = ((16a−12)a+4)a for a ≤ 0.25, else a | High | The quoted line is g(a). The harness does not run this row as a complete soft-light function |
| Opacity applies on top of the mode | Photoshop and GIMP allow opacity on the top layer | High | — |
| Normal is the default | the default mode obscures the lower layer | High | — |
| Dodge, burn, hue, saturation, colour, luminosity | sections exist on the page | — | Not read in this run. The fetch cut at about 21,000 characters, before those passages. Do not copy formulas for them from this page. |
Read the branch, not the name. Overlay and hard light are the same two expressions with the inputs swapped. The only difference is which colour the 0.5 test runs on. They match only at 0.5.
The rule, in pseudocode
def multiply(a, b): return a * b
def screen(a, b): return 1 - (1 - a) * (1 - b)
def overlay(a, b):
return 2*a*b if a < 0.5 else 1 - 2*(1-a)*(1-b)
def hard_light(a, b):
return 2*a*b if b < 0.5 else 1 - 2*(1-a)*(1-b)
# predicted_8bit = round(f(a/255, b/255) * 255)Paints the two colours with the browser's composite operator, reads the pixel back, and compares it with each published definition. A max deviation of 0–1 means rounding only.
press MeasureTry it yourself
Do not tell me what "multiply" means conceptually. Write the per-channel
expression this application uses, then design a two-colour test that
would distinguish it from every other mode that produces a similar look.
Run the test and report the observed channel values.The same shape — one file, several layers of responsibility — shows up in the clipboard failure ladder. How a PDF stores its objects is the companion page.
What we could not confirm. Which of the soft-light definitions a given current application ships. The harness measures your browser, not Photoshop, and Photoshop was not available to read a channel value from. If the engine works in linear light or applies a colour profile, the arithmetic still holds and the inputs are different numbers.