RetouchPRO

Go Back   RetouchPRO > Technique > Photo Compositing
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read


Photo Compositing Collage, montage, masking, selections, combining, etc.

how does PS merge layers?

Reply
 
Thread Tools
  #1  
Old 05-22-2004, 06:42 PM
mediatevictoria mediatevictoria is offline
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
Reply With Quote top
  #2  
Old 05-22-2004, 09:07 PM
Doug Nelson's Avatar
Doug Nelson Doug Nelson is offline
Janitor
 
Join Date: Aug 2001
Posts: 7,068
Blog Entries: 21
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?
Reply With Quote top
  #3  
Old 05-23-2004, 09:14 AM
Vikki Vikki is offline
Senior Member
 
Join Date: Aug 2001
Location: Arizona
Posts: 883
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?
Reply With Quote top
  #4  
Old 05-23-2004, 09:26 AM
kiska's Avatar
kiska kiska is offline
Senior Member
 
Join Date: Feb 2004
Location: mentone,ala
Posts: 623
TOTALLY befuddled !

kiska
Reply With Quote top
  #5  
Old 05-23-2004, 10:00 AM
gmitchel gmitchel is offline
Senior Member
 
Join Date: Apr 2004
Location: Tallahassee, FL
Posts: 316
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
Reply With Quote top
  #6  
Old 05-23-2004, 11:49 AM
Gary Richardson's Avatar
Gary Richardson Gary Richardson is offline
Senior Member
 
Join Date: Mar 2004
Location: Yorkshire, England
Posts: 2,717
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.
Reply With Quote top
  #7  
Old 05-23-2004, 01:12 PM
mediatevictoria mediatevictoria is offline
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]
Reply With Quote top
  #8  
Old 05-24-2004, 03:00 AM
Gary Richardson's Avatar
Gary Richardson Gary Richardson is offline
Senior Member
 
Join Date: Mar 2004
Location: Yorkshire, England
Posts: 2,717
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.
Reply With Quote top
  #9  
Old 05-24-2004, 04:22 AM
kiska's Avatar
kiska kiska is offline
Senior Member
 
Join Date: Feb 2004
Location: mentone,ala
Posts: 623
UNCLE!!! my brain hurts.

kiska
Reply With Quote top
  #10  
Old 05-28-2004, 10:46 AM
byRo's Avatar
byRo byRo is offline
Senior Member
 
Join Date: May 2004
Location: Goianésia, Brazil
Posts: 1,609
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
Reply With Quote top
Reply

  RetouchPRO > Technique > Photo Compositing


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Several Photoshop Layer Tips DJ Dubovsky Photo Compositing 6 12-05-2006 03:35 PM
Understanding when and what type of layers to use in photo restoration Gerald McClaren Photo Restoration 3 12-08-2005 11:34 AM
Applying a Logo to an Image CJ Max Photoshop Help 5 03-17-2005 05:32 AM
Can't merge layers when creating mask BrianF Hidden Power Support 1 06-18-2003 06:59 PM
Merge Layers Tip Sharon Photo Retouching 2 12-12-2001 09:55 PM


All times are GMT -6. The time now is 07:37 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2016 Doug Nelson. All Rights Reserved