| Notices | Welcome to RetouchPRO . You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload images and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. | | Photo Compositing Collage, montage, masking, selections, combining, etc. | 
05-22-2004, 05:42 PM
| | Junior Member | | Join Date: May 2004
Posts: 5
| | | how does PS merge layers? Am I in the right forum, or should this query be posted elsewhere?
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
(r,g,b).
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.
Ben Winter | 
05-22-2004, 08:07 PM
|  | Janitor | | Join Date: Aug 2001
Posts: 3,908
| | | 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? | 
05-23-2004, 08:14 AM
| | Senior Member | | Join Date: Aug 2001 Location: Arizona
Posts: 882
| | | 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? | 
05-23-2004, 08:26 AM
|  | Senior Member | | Join Date: Feb 2004 Location: mentone,ala
Posts: 593
| | | TOTALLY befuddled !
kiska | 
05-23-2004, 09:00 AM
| | Senior Member | | Join Date: Apr 2004 Location: Tallahassee, FL
Posts: 180
| | 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.
Cheers,
Mitch | 
05-23-2004, 10:49 AM
|  | Moderator | | Join Date: Mar 2004 Location: Yorkshire, England
Posts: 2,680
| | | 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. | 
05-23-2004, 12:12 PM
| | Junior Member | | Join Date: May 2004
Posts: 5
| | | 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] | 
05-24-2004, 02:00 AM
|  | Moderator | | Join Date: Mar 2004 Location: Yorkshire, England
Posts: 2,680
| | | 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. | 
05-24-2004, 03:22 AM
|  | Senior Member | | Join Date: Feb 2004 Location: mentone,ala
Posts: 593
| | | UNCLE!!! my brain hurts.
kiska | 
05-28-2004, 09:46 AM
|  | Moderator | | Join Date: May 2004 Location: Goiânia, Brazil
Posts: 1,546
| | | 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.
..Lunchtime...
Roland |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -6. The time now is 04:19 PM. | |
|