# [Gimp-user] Overlay layer mode

```object: Overlay layer mode

I read in the last version of the user's manual the description of the
overlay layer mode, at following address :

http://docs.gimp.org/2.6/en/gimp-concepts-layer-modes.html

I only consider the case where the option "Colors / Use GEGL" is
checked and thus where Bug #162395 is no longer to consider.

The manual notes I the color component of a pixel in the lower layer,
M the corresponding pixel's color component in the upper layer and
E the resulting pixel component. For the Overlay mode, the following
equation is provided :

E = (M/255) * (I + (2*M/255) * (255-I))

This equation is accompanied by the following descriptive text:

"Overlay  mode inverts the pixel value of the lower layer, multiplies
it by two times the pixel value of the upper layer, adds that to the
original pixel value of the lower layer, divides by 255, and then
multiplies by the pixel value of the original lower layer and divides
by 255 again."

First problem: except error, textual description does not correspond to
the first equation quoted above, but to the second following equation :

E2 = (I/255) * (I + 2*M*(255-I))/255

Second problem: I carried out some tests with GIMP 2.6.7 (with the
option "Colors / Use GEGL" checked) and I obtain the following
results :

1) for I = 64 and M = 192
the first equation leads to E = 265
the second equation provides E2 = 72
in experiments recorded value is E3 = 88

2) for I = 192 and M = 64
the first equation leads to E = 56
the second equation provides E2 = 24
in experiments recorded value is E3 = 169

If this analysis is confirmed, it thus seems that both the equation
quoted in the manual and textual description for Overlay layer mode
are incorrect.

I obtain an agreement between the "experimental" values and this third
equation below :

E = (I/255) * (I + (2*M/255) * (255-I))

--

[translated from French]

Paul
```
```
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
```