<p>If you are using OpenGL and if you are referring to Photoshop's layer blend functions. This may be a complete answer for you</p>
<p><a href="https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/" rel="nofollow noreferrer">https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/</a></p>
<p>I found that link from this one</p>
<p><a href="https://stackoverflow.com/questions/818230/photoshop-blending-mode-to-opengl-es-without-shaders?rq=3">https://stackoverflow.com/questions/818230/photoshop-blending-mode-to-opengl-es-without-shaders?rq=3</a></p>
<p>The rest here is not EXACTLY an answer to your question, because I do not fully understand your question. Do please add more information about how you need to apply this math for more practical answers.</p>
<p>While I don't know what the exact equations are, the blend options in Photoshop have been available for a very long time. My guess is that each layer (legacy) blend mode represents a fairly simple mathematical equation.</p>
<p>Given what photoshop is and who adobe is and how advanced their functionality has always been I would not be at all surprised if they were writing custom GFX card code way back when. However with the shear amount of GFX card code that was written for very specific hardware for specific engines like DirectX and OpenGL historically(and currently), chances are that they leveraged capabilities that have been directly available in these engines for a long time.</p>
<p>My guess is that you can simulate all of the layer blend modes with something like OpenGL's &quot;blendEquation&quot; and &quot;blendFunc&quot;, which amounts to modifying how the values between two layers are added together.
<a href="https://learnopengl.com/Advanced-OpenGL/Blending#Blending" rel="nofollow noreferrer">https://learnopengl.com/Advanced-OpenGL/Blending#Blending</a></p>

CC BY-SA 4.0
2024-02-06T18:58:41.770Z
2024-02-06T18:58:41.770Z
Jody Sowald
<p>I have figure out the math with use legacy checked.
but I don't know what is the math ps use with use legacy unchecked.</p>

<image-processing>
what is the math behind contrast&brightness adjustmentlayer in photoshop?
Celebrimbor
# what is the math behind contrast&brightness adjustmentlayer in photoshop?

(Asked by: username_0 on 2024-01-26)

I have figure out the math with use legacy checked.
but I don't know what is the math ps use with use legacy unchecked.

**Tags:** image-processing


---

## 1 answers

### Answer by username_1 on 2024-02-06. Score: 0

If you are using OpenGL and if you are referring to Photoshop's layer blend functions. This may be a complete answer for you

<https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/>

I found that link from this one

<https://stackoverflow.com/questions/818230/photoshop-blending-mode-to-opengl-es-without-shaders?rq=3>

The rest here is not EXACTLY an answer to your question, because I do not fully understand your question. Do please add more information about how you need to apply this math for more practical answers.

While I don't know what the exact equations are, the blend options in Photoshop have been available for a very long time. My guess is that each layer (legacy) blend mode represents a fairly simple mathematical equation.

Given what photoshop is and who adobe is and how advanced their functionality has always been I would not be at all surprised if they were writing custom GFX card code way back when. However with the shear amount of GFX card code that was written for very specific hardware for specific engines like DirectX and OpenGL historically(and currently), chances are that they leveraged capabilities that have been directly available in these engines for a long time.

My guess is that you can simulate all of the layer blend modes with something like OpenGL's "blendEquation" and "blendFunc", which amounts to modifying how the values between two layers are added together.
<https://learnopengl.com/Advanced-OpenGL/Blending#Blending>


---

