# Can someone explain the exact behavior of add/subtract/intersect/invert for alpha channels in photoshop?

Suppose I have two different single pixel (ie 1x1 pixel) alpha channels.

The channels are called A and B.

Since everything is grayscale, I will normalize my alpha channel values to between 0 and 1, 0 being completely black and 1 being completely white.

I would like a formula that tells me the result when I subtract B from A (On a mac, this is Cmd+Click A and then Option+Cmd+Click B and then create a new alpha channel and paint bucket in 100% white). Let the result be denoted A - B.

Similarly, I would also like a formula that tells me the result when I add B to A (using shift+cmd+click on a mac). Let this be denoted A+B.

I would also like a formula that tells me the result when I intersect A and B (shift+option+cmd+click on a mac). Let this be denoted A cap B.

I would also like a formula that tells me the result when I invert A (Cmd+I on a mac). Let this be denoted Inv(A).

Here are some examples to show that this is not what one might think:

Suppose A = 1 and B = 0.5. Then A - B = 0.66666 = 2/3. Why???

Suppose A = 0.5, then Inv(A) = 0.66666 = 2/3. Why?????

Suppose A = 0.25, then Inv(A) = 0.86. Why????

Suppose A = 0.5, then A cap A = 0.24. Why?????

Suppose A = 0.5, then (A cap A) cap A = 0.1 Whyyyyyyy?

Is there a reference where this is all explained?

• What are the results you're referring to? New channel, layer from selection, quick mask...? When I subtract 1 - 0.5 I'm getting 0.5, Inverted 0.5 gives me 0.5, etc: so everything works as expected. Could you upload screenshots of the results, psds? Aug 25, 2019 at 8:12
• @SergeyKritskiy The simplest example is this. I create a new alpha channel, fill it with a value of 0.5 (50% gray). Then I hit "Cmd+I" (to invert), and the result is 0.66. You can find the psd document here: drive.google.com/file/d/1mw5_Jz8XdiLaDRt8SOa8D_Dcp_gNOgOm/… Aug 25, 2019 at 8:37
• Color is not linear, whether alpha should be is a bit debatable... Aug 25, 2019 at 11:08

This is probably because you have `Dot 20%` (or something similar) as `Gray Working Space` in `Edit > Color Settings` menu — this profile is intended for printing greyscale images and it's not the same as digital gamma corrected greyscale gauge.
Someone with better knowledge of how color profiles work might explain what exactly happens in there but `#808080` in `Dot 20%` equals to `#696969` in gamma corrected working space. Here's a comparison: on the left your file with `#808080` B and `A-B` being `#a9a9a9` in `Dot 20%` grey working space and on the right your file with `2.2 Gamma` working space: A-B is as being expected, `#808080`: 