[Cin] Gimp's blend Vs CinGG's blend

Andrea paz gamberucci.andrea at gmail.com
Tue Mar 25 21:55:15 CET 2025


I wanted to try using Blend Algebra to recreate Gimp's blend types
inside CinGG. I couldn't because I don't really understand the
formulas used by Gimp, or rather, what I understand less are the
formulas used by CinGG. I understand that these are pre-multiplied
while Gimp's are normal (“straight”). But even without taking this
into account, I don't really understand how to compare the formulas
(https://docs.gimp.org/3.0/en/gimp-concepts-layer-modes-legacy.html).
For example, for the “Multiply” blend we have two different formulas,
even though the manual says that the CinGG formula is the same as the
Gimp formula:

Gimp

E = 1/255*(M*I)  where “M” (foreground), if I understand correctly,
corresponds to our “D” and “I” (background) corresponds to our “S”

so it could be written:

E = 1/255*(D*S)

Instead, CinGG's formula is:

[(Sa+Da-Sa*Da), Sc*(1-Da)+Dc*(1-Sa)+Sc*Dc]

I cannot compare the two formulas, there is one too many Sc*(1-Da) and
one too many Dc*(1-Sa), and a 1/255 is missing.

Note: The presence of the parentheses like (1-Sa) is what makes me
suspect that CinGG's formulas are “pre-multiplied”
(https://en.wikipedia.org/wiki/Alpha_compositing#Straight_versus_premultiplied.)

There are three types of blends whose formulas differ (and which I
wanted to implement via Blend Algebra):
(Normal); Addition; Subtract and Divide.
Then there are Gimp blends that CinGG doesn't have, but they don't
seem interesting to me.

PS: I tried to look for the formulas used by CinCV but I don't know
where to find them; do they exist anywhere?


More information about the Cin mailing list