• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

How does Photoshop determine the new RGB pixel values when the top layer's opacity is lowered?

New Here ,
Oct 28, 2017 Oct 28, 2017

Copy link to clipboard

Copied

For example, the top layer's RGB values for a given pixel are:

R=11
G=208
B=206

And the same pixel on the layer under it are (found by turning of visibility of the top layer):

R= 195

G=57

B=63

When the top layer's visibility is turned back on and it's opacity is changed to 80%, the new values for the same pixel are now:

R=71

G=184

B=183

The question is: How does Photoshop calculate the new values?

[Moved from the non-technical Lounge Forum to the Program forum... Mod]

[Here is the list of all Adobe forums... https://forums.adobe.com/welcome]

Views

1.2K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 28, 2017 Oct 28, 2017

Copy link to clipboard

Copied

I would not expect the Pixel color to change at all. I think it would be more like adding a gray layer mask that makes the whole layer partly transparent the color you see is the result of blending.  Create a new document fill the background with red.  Convert to a normal layer 0.  Lower the opacity.  You do not see one color you see the transparency checkerboard blended in you see two red shades.   Use the color sampler on the layer it will sample 255 0 0 red.

JJMack

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2017 Oct 28, 2017

Copy link to clipboard

Copied

Thanks, JJMack.

My question was purely theoretical. If you have two layers, say some text on the top layer, and a photo beneath, and you wanted the text to be semi transparent, you would lower the opacity of the text layer.

By enlarging the screen all the way, to 3200%, you see the individual pixels - be sure the pixel grid is on.

First set the text or top layer to 100% opacity, and in the example above, sampling one pixel with the eyedropper tool shows the rgb values of the text layer pixel. R=11

If you then hide that layer by clicking the eyeball, and, with the eyedropper,sample the exact same pixel of the picture underneath, you get the rgb values for it. R=195

Then turn the visibility for the text or top layer back on, and change the opacity to 80%, you get the rgb value for the pixel, as shown in the example. R=71

I was just wondering what the math is that photoshop uses to arrive at this value.

I was trying 80% of the R = 11 value plus 20% of the R=195 value, but that doesn't add up to 71.

Can anyone come up with the math that Photoshop uses?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 29, 2017 Oct 29, 2017

Copy link to clipboard

Copied

So you want to know the displayed RGB, not the pixel values. The math is all public - for example in the PDF specification - and depends on the blend mode.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 29, 2017 Oct 29, 2017

Copy link to clipboard

Copied

It depend on how many layers  above and below are involved in the blending of the document pixel blending and the blending modes involved.   Blending the layer composite view is very complex the math use depends on many things.

JJMack

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 29, 2017 Oct 29, 2017

Copy link to clipboard

Copied

Afraid I cannot answer your question , but you might like to look up Dr Alvey Ray Smith who invented the alpha channel and co-founded Pixar. I can tell you the relationship between two pixels on separate layers is given by

tA+(1-t)B

where t=the transparency of the uppermost layer as a decimal(actually t is written alpha usually-hence the name alpha channel)

A is a pixel on the topmost layer and B is the corresponding pixel on the layer below.

So if the transparency is 70%

0.7A+(1-0.7)B

or 0.7A+0.3B

this means in the combined layers at 70% transparency the final pixel value consists of 70% of the top pixel value and 30% of the bottom pixel value. How that translates to RGB I cannot tell you

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 29, 2017 Oct 29, 2017

Copy link to clipboard

Copied

Photoshop's transparency (and PDFs) is much more complex than alpha channels, though I think it can work in an equivalent way. I definitely agree that a starting point is to forget the spurious idea that RGB values lie between 0 and 255. They are floating point numbers between 0.0 and about 1.0 in any colour science.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

Did you ever find the answer to this question? Clearly the PDF equation is not it. E.g.: 11*0,8+195*0.2=47 and not 71. I am searching for this info everywhere, but no success yet.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

Hi! I thought about 2 things: we know that there is gamma at work, maybe one could test in a gamma 1 to see if math works there too. Also, but it is maybe related, we know that the gradients are not linear either, that they do not have a linear gradation, for optical correction. Could the transparency "curve" be non linear as well, to compensate for our eyes' fantastic response?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

LATEST

Yes, I think that's the answer, and it's called "Blend Gamma". Then it just becomes math.

 

You can set blend gamma for RGB color (and text) in color settings. Both are best left at default except in some special cases.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines