|Photo Compositing Collage, montage, masking, selections, combining, etc.|
| ||Thread Tools|
how does PS merge layers?
What happens when you merge layers [image, not fill or adjustment] in Photoshop? The qualitative answer seems to be: WYSIWYG. But I am looking for a quantitative answer. I am looking for a precise - mathematical, if you will - description of the effect of the Photoshop Merge command.
Suppose I have two layers, 1 on top and 2 below it, and consider a position [pixel] P where the RGB intensities [on the usual 0-255 scale] are (r1, g1, b1) in layer 1 and (r2, g2, b2) in layer 2. Opacities are t1 and t2 [on the usual 0-100% scale].
Both layers are visible. Layer 1 is active. When I merge the two layers, the RGB intensities at the position P will be
My question: how is r related to r1,t1,r2,t2 ? And likewise for b and g.
What happens if I merge three layers?
Thanks in advance for all the erudite responses that will doubtless be forthcoming.
I guess I'm uncertain about what you mean exactly. If R is 255 and you reduce its transparency 50%, it's now 128. Discounting blend modes, it will add R128 to any color below it, so 0,0,255 will become 128,0,255.
Am I oversimplifying?
I'm sorry, but I have no idea what you're asking (maybe I haven't had enough coffee yet?). Any chance you can rephrase the question in non-math terms?
My only response, at this time, would be, have you "merged" the layers and taken a reading?
If both layers are at 100% opacity and the blend mode is Normal, any non-transparent pixels in the uppermost layer will be the pixel values for the merged layer.
Think of layers as sheets of acetate. Whatever is on top will be what is visible. At 100% opacity, the pixels are like perfectly opaque ink. They allow nothing from lower layers to show through.
Certainly, different settings for blend mode or opacity will affect things. Same with the Blend If sliders. You can alter the default behavior in lots of ways with Layer Styles.
You can find a description of the various blend modes in any good book on PS. For example, Multiply mode is aptly named. It multiplies the pixels from both layers together and then divides by 255. What this means is that if either pixel is 0, the result will be zero. But if either is 255, you will get the value of the other pixel, since 255/255 = 1.
What will happen to individual pixel values will depend entirely on which blend method you have chosen, the exact mathematical calculation of which would best be addressed as a question to Adobe.
There is no one answer since there are many blend modes.
Thanks for all your replies. Allow me to comment on them, and then make my query more concrete.
Doug's example is indeed simpler than what I had in mind. A more complex, perhaps more illustrative, example is given at the end of this post.
Vikki asks whether I've taken a reading. My query actually looks at the matter in the opposite direction: given all the necessary information about two layers, how do you _predict_ what the readings will be? I.e., what are the rules that govern the Merge operation?
Kiska - if you think you are befuddled now, just wait 'til we get further into this swamp!
Gary correctly observes that much depends on the blendmodes in effect. Let me clarify: I am interested in the basic operation of the Merge command, apart from blendmode effects. I am only aksing about what Merge does when all visible layers have blendmode Normal.
Gmitchell states the generally known rule ["sheets of acetate"] for the case blendmode Normal op.100% . . But what happens if we depart just a bit from that simple situation? What happens if opacities are less than 100%?
To avoid further confusion as to what it is I am asking, consider the following concrete example.
Using Photoshop Elements 2, I made a brand new image [transparent], added a fill layer [solid color RGB (150, 100, 50), mergemode Normal, op.80%]; call that layer A. Then added another fill layer [solid color RGB (250, 100, 0), mergemode Normal, op.60%]; call that layer B. Then did Merge Visible. -- What do you think will be the RGB for the final result? Does your conclusion match the reading on the Info palette?
That was with layer B on top of layer A. What do you think you'll get if you switch layers, to A on top of B?
I am looking forward to the next batch of responses.
Ben Winter [aka mediatevictoria]
Tried out your experiment ...... interesting, not predictable by me at any rate. However I am unaware of the algorithm that is being used to calculate values. As I said before Adobe are really the only people you are likely to get this information from, or ex-adobe employees willing to tell. Best of luck with your endeavour, post results if you find out.
Here's come the math
This is a really great site.
I've been lurking in the shadows for some time, but now it seems there's somewhere that I can be of some use.
First a slight correction of the question, lets call the opacity o1 and not t1 (this gets important later).
I think this is what you're looking for:
r12 = (r1o1 + (r2 - r1o1) * o2) / o12 ........ where
o12 = 1 - (1 - o1) * (1-o2)
Repeat for 'b' e 'g' and (if I wrote it all down right) you'll get the numbers 215 / 100 / 17 just like the info palette tells you. What the info palette doesn't tell you is that the resultant layer has an opacity of 92%.
The 'o12' bit is easier if you consider transparency and not opacity. Then you can write:
t12 = t1 * t2 ......... where t = 1 - o
Well! You asked for it.
Now my little brain hurts too.
|Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Several Photoshop Layer Tips||DJ Dubovsky||Photo Compositing||6||12-05-2006 02:35 PM|
|Understanding when and what type of layers to use in photo restoration||Gerald McClaren||Photo Restoration||3||12-08-2005 10:34 AM|
|Applying a Logo to an Image||CJ Max||Photoshop Help||5||03-17-2005 04:32 AM|
|Can't merge layers when creating mask||BrianF||Hidden Power Support||1||06-18-2003 05:59 PM|
|Merge Layers Tip||Sharon||Photo Retouching||2||12-12-2001 08:55 PM|