Open Photography Forums  
HOME FORUMS NEWS FAQ SEARCH

Go Back   Open Photography Forums > Digital Darkroom > Image Processing and Workflow

Image Processing and Workflow RAW, DNG , TIFF and JPG. From Capture to Ready for Publish/Display. All software and techniques used within an image workflow, (except extensive retouching and repair or DAM).

Reply
 
Thread Tools Display Modes
  #1  
Old July 12th, 2010, 06:33 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default Photoshop - the "luminosity" blend mode

For many operations, Photoshop affords as a choice of numerous "blend modes". A blend mode basically define the rules by which, for example, the color of a "paint" used to paint a swath across an existing image combines with the existing color at each pixel location to give the new color at that location.

A second kind of operation to which blend mode is pertinent is an adjustment or filter, as for example unsharp mask. These functions generate an "amendment" to the image, which can be combined with the initial image to produce an adjusted image.

The most common blend mode - the one that is in effect if we take no steps to invoke a different one, is called normal. Another one we often hear of using (especially in connection with adjustments and filters) is luminosity. The general concept of this is that, regardless of the chromaticity of the adjustment, only the "luminosity" of the exiting colors is changed.

But exactly what does that mean, and is it even so?

I've done a bit or reverse engineering in this regard, and I'll summarize my findings here. My actual testing was done in the "overpaint" context (not, for example, for an "adjustment") - it is practical to test for the former, and very tough for the latter.

My guess is that the general principles I describe are equally applicable to the "adjustment" situation, but there are some additional wrinkles there - such as the possibility that the coordinates of the "adjustment" may have negative values - that can tangle the matter up.

That having been said, this seems to be the scoop on the luminosity mode.

The normal blend mode

First, to help establish the frame of reference, I will describe the working of the normal blend mode. Following the context in which I did my study, I will speak of the "background"color, the "paint" color, and the "resulting" color.

I will use the symbol C to stand for R, G, or B, for situations in which all three follow identical equations. That way, I don't have to write the equations three times. I will use the suffix "b" for the coordinates of the background color, "p" for the paint color, and no suffix for the resulting color.

The equations will take into account our ability to set an opacity for the operation. Although we normally set this in percent, with a range of 0% to 100%, in the equations, I will assume a scale of 0-1, and I will use the symbol K. Simply, when K=1 we get the "full" effect of the operation, when K=0 we get no effect. For K=0.5, we get "half the effect".

So when we paint, the R, G, and B coordinates of the resulting color at each pixel are given by:

C=(K*Cp)+((1-K)*Cb)

Essentially, if K=1, the paint color is what we end up with. If K=0, the paint does nothing - it is completely impotent.

The luminosity blend mode

1. In this mode, the "paint", regardless of its actual color, acts in every respect as if it were gray.

Its "effective" coordinates (suffix "e") are:

Re=Ge=Be= (76R/255)+(150G/255)+(28B/255)

Note that the relative luminance of this "effective paint color" is not the actual relative luminance of the actual paint color; this is a "pseudo-luminance".

Thus if we paint with the color R,G,B = 255,127,127, it acts in every way as if we paint with the color 165,165,165.

2. The background color is amended by the paint's effective R/G/B value and the opacity in effect. To overall equations are complicated (I haven't completely reverse-engineered them), but the punch line is that the hue of the result is always unchanged from the hue of the background.

Now, in some cases, the saturation is changed, and in some cases, the luminance, and in some cases, both. This in part comes from the fact that we have an upper limit of 255 for each coordinate of the result color, so there are limits on what can be changed (if we are going in the "upward" direction).

So, it is not necessarily true that an operation in the luminosity blend mode only changes the luminance of the image color. Thus is is not necessarily true that it keeps the chrominance the same. Nor that it keeps the chromaticity unchanged (another possibility). What is true is that it does not change the hue.

Best regards,

Doug
Reply With Quote
  #2  
Old July 12th, 2010, 10:18 PM
Asher Kelman Asher Kelman is offline
OPF Owner/Editor-in-Chief
 
Join Date: Apr 2006
Posts: 34,132
Default

Quote:
Originally Posted by Doug Kerr View Post
...

Now, in some cases, the saturation is changed, and in some cases, the luminance, and in some cases, both. This in part comes from the fact that we have an upper limit of 255 for each coordinate of the result color, so there are limits on what can be changed (if we are going in the "upward" direction).

So, it is not necessarily true that an operation in the luminosity blend mode only changes the luminance of the image color. Thus is is not necessarily true that it keeps the chrominance the same. Nor that it keeps the chromaticity unchanged (another possibility). What is true is that it does not change the hue.
Doug,

If that is indeed true, then it supports using LAB color space for making the blending as some people are wont to do.

Asher

You might define for completion sake Chrominance and Chromaticity, one more time, so anyone reading this will make sense of it!
__________________
Follow us on Twitter at @opfweb

Our purpose is getting to an impressive photograph. So we encourage browsing and then feedback. Consider a link to your galleries annotated, C&C welcomed. Images posted within OPF are assumed to be for Comment & Critique, unless otherwise designated.
Reply With Quote
  #3  
Old July 13th, 2010, 02:12 AM
Bart_van_der_Wolf Bart_van_der_Wolf is offline
pro member
 
Join Date: Jun 2006
Location: Netherlands
Posts: 4,046
Default

Quote:
Originally Posted by Doug Kerr View Post
Now, in some cases, the saturation is changed, and in some cases, the luminance, and in some cases, both. This in part comes from the fact that we have an upper limit of 255 for each coordinate of the result color, so there are limits on what can be changed (if we are going in the "upward" direction).

So, it is not necessarily true that an operation in the luminosity blend mode only changes the luminance of the image color. Thus is is not necessarily true that it keeps the chrominance the same. Nor that it keeps the chromaticity unchanged (another possibility). What is true is that it does not change the hue.
Hi Doug,

Don't forget to check the 'Advanced' Color settings (edit menu) that allows to blend at a gamma 1 setting instead of the document's colorspace gamma. I have my Photoshops set to gamma 1 blending, I believe it is off by default.

Cheers,
Bart
Reply With Quote
  #4  
Old July 13th, 2010, 03:08 AM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default

Hi, Bart,

Quote:
Originally Posted by Bart_van_der_Wolf View Post
Don't forget to check the 'Advanced' Color settings (edit menu) that allows to blend at a gamma 1 setting instead of the document's colorspace gamma. I have my Photoshops set to gamma 1 blending, I believe it is off by default.
Thanks for the reminder. I need to look into that!

Best regards,

Doug
Reply With Quote
  #5  
Old July 20th, 2010, 09:24 AM
Andrew Rodney Andrew Rodney is offline
Member
 
Join Date: May 2006
Posts: 467
Default

I think the Blend Gamma in Color Settings only affect color space conversions. At least when I apply the same layer with and without the check box on, the results, when subtracting the two are identical.
__________________
Andrew Rodney
Author "Color Management for Photographers"
http://www.digitaldog.net/
Reply With Quote
  #6  
Old July 20th, 2010, 01:31 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default

Hi, Andrew,

Quote:
Originally Posted by Andrew Rodney View Post
I think the Blend Gamma in Color Settings only affect color space conversions. At least when I apply the same layer with and without the check box on, the results, when subtracting the two are identical.
Thanks for the report.

I got tangled up in another matter, and have not yet had a chance to play with that.

Best regards,

Doug
Reply With Quote
  #7  
Old July 21st, 2010, 04:50 AM
Bart_van_der_Wolf Bart_van_der_Wolf is offline
pro member
 
Join Date: Jun 2006
Location: Netherlands
Posts: 4,046
Default

Quote:
Originally Posted by Andrew Rodney View Post
I think the Blend Gamma in Color Settings only affect color space conversions. At least when I apply the same layer with and without the check box on, the results, when subtracting the two are identical.
Hi Andrew,

Try the following stress test;
  • Create a new image in Photoshop, e.g. with sRGB colorspace.
  • Fill it with Magenta, e.g. R=200, G=0, B=200.
  • Create a new transparent layer, normal blending mode.
  • Create on that new layer a Green, R=0, G=200, B=0, square or other shaped selection, and rotate it so that the edges have a semi-transparent anti-aliased edge transition with the layer transparency.

Now zoom in on the edge to make it easier to see, and toggle the blend RGB colors option on or off.

This is what happens to the edge in 'Normal' blending mode:


This demonstrates that RGB blending is influenced by the Gamma Blending option. Of course this is an extreme example and in many images the difference will be hard to see. However, especially at sharp edge transitions (e.g. when using a sharpening layer) there can be unwanted/unexpected colors/brightnesses that are introduced merely by using the wrong gamma setting.

Luminosity blending mode is a different operator alltogether, I'm not sure (although it seems better behaved) how that's exactly affected (if at all) by the gamma blending setting.

Cheers,
Bart
Reply With Quote
  #8  
Old July 21st, 2010, 04:17 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default

Hi, Bart,

Very interesting result.

I have to ponder just what that means!

Thanks.

Best regards,

Doug
Reply With Quote
  #9  
Old August 11th, 2010, 12:29 PM
Luiz Vasconcellos Luiz Vasconcellos is offline
Member
 
Join Date: Sep 2006
Location: Brazil
Posts: 44
Default

It affects everything!
I always wonderer why the edges were so bad... Now we know!! Thanks Bart_van_der_Wolf !!!
Reply With Quote
  #10  
Old August 11th, 2010, 12:55 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default

Hi, Luiz,

Quote:
Originally Posted by Luiz Vasconcellos View Post
It affects everything!
I always wonderer why the edges were so bad... Now we know!! Thanks Bart_van_der_Wolf !!!
Great demonstration.

Could you tell me just how you constructed this.

Thanks.

Best regards,

Doug
Reply With Quote
  #11  
Old August 11th, 2010, 01:44 PM
Luiz Vasconcellos Luiz Vasconcellos is offline
Member
 
Join Date: Sep 2006
Location: Brazil
Posts: 44
Default

You are welcome, I just used a brush(zero hardness) with an inverted color from the background and placed a TXT with AA in smooth mode, the BIG ON/OFF on the right are re-sized(Nearest Neightbor) crops.
Reply With Quote
  #12  
Old August 11th, 2010, 05:25 PM
Bart_van_der_Wolf Bart_van_der_Wolf is offline
pro member
 
Join Date: Jun 2006
Location: Netherlands
Posts: 4,046
Default

Quote:
Originally Posted by Luiz Vasconcellos View Post
It affects everything!
I always wondered why the edges were so bad... Now we know!! Thanks Bart_van_der_Wolf !!!
Hi Luiz,

You're welcome. I just happen to know things, about photography in particular (but not limited to that ;-) ).

Yours is a nice demonstration that also smooth gradients (as well as high spatial frequency detail) can suffer from blending in anything else than gamma 1 (which luckily is only a preference setting away in Photoshop). Complementary colors are most vulnerable, but others are involved as well, to different degrees.

In general, one would perform image math in linear gamma. An exception (to the rule) might be USM sharpening, which could result in different magnitude negative versus positive edge enhancement.

Cheers,
Bart
Reply With Quote
  #13  
Old August 11th, 2010, 06:46 PM
Luiz Vasconcellos Luiz Vasconcellos is offline
Member
 
Join Date: Sep 2006
Location: Brazil
Posts: 44
Default

Thanks,
Correction to my first post, it does not affect everything...
I did a test and it affects the layers blending, the brushes, but not all Photoshop blur types.
Funny is that Alien Skin Bokeh is always the opposite effect from CS5.


Here a simple video if anyone is interested http://www.vimeo.com/14075970
better quality here http://dl.dropbox.com/u/4686872/gamma-test.mp4

BTW, It is not my intention to hijack Mr. Doug Kerr thread...
Reply With Quote
  #14  
Old August 16th, 2010, 12:47 AM
Joachim Bolte Joachim Bolte is offline
Member
 
Join Date: Aug 2010
Posts: 151
Default

Quote:
Originally Posted by Bart_van_der_Wolf View Post
Hi Luiz,
In general, one would perform image math in linear gamma. An exception (to the rule) might be USM sharpening, which could result in different magnitude negative versus positive edge enhancement.
Using linear calculations can come in handy, but it has it's quirks... You are letting the computer calculate data in a way you're eyes are not accustomed too. This will have an effect on EVERY blending-calculation PS does, also the layer-blends and the masking, and not just the anti-aliassing setting that Bart is talking about here.

So be VERY sure of what you are doing, before you turn on that switch. I've went a little deeper on the subject in this thread on the DPR retouching-forum, to show the effects of what can happen. Especially on page three of the thread is a very clear example with a vignette-mask that you should see.

http://forums.dpreview.com/forums/re...hread=36017517
Reply With Quote
  #15  
Old August 16th, 2010, 03:57 AM
Joachim Bolte Joachim Bolte is offline
Member
 
Join Date: Aug 2010
Posts: 151
Default

Quote:
Originally Posted by Doug Kerr View Post
So, it is not necessarily true that an operation in the luminosity blend mode only changes the luminance of the image color. Thus is is not necessarily true that it keeps the chrominance the same. Nor that it keeps the chromaticity unchanged (another possibility). What is true is that it does not change the hue.
That's because in RGB-colorspaces the luminocity and the color are linked. you cannot change luminocity without altering the color of an object. Best thing RGB can do is compute a similar hue when doing calculations. That comes at a cost, it implies that the calculations considering the true luminocity will be less precise.

And that is where Lab mode comes in handy, because it splits the lumo-info and the color info to separate channels. In theory it is possible to make a sparkling yellow black or white in Lab. :)

There is some nice reading about that in Dan Margulis's book, 'Photoshop Lab space' (a must-have as far as I'm concerned). It states how and when you can use RGB, CMYK and Lab most efficient and powerfull.
Reply With Quote
  #16  
Old August 16th, 2010, 07:41 AM
Bart_van_der_Wolf Bart_van_der_Wolf is offline
pro member
 
Join Date: Jun 2006
Location: Netherlands
Posts: 4,046
Default

Quote:
Originally Posted by Joachim Bolte View Post
That's because in RGB-colorspaces the luminocity and the color are linked. you cannot change luminocity without altering the color of an object. Best thing RGB can do is compute a similar hue when doing calculations. That comes at a cost, it implies that the calculations considering the true luminocity will be less precise.

And that is where Lab mode comes in handy, because it splits the lumo-info and the color info to separate channels. In theory it is possible to make a sparkling yellow black or white in Lab. :)
Hi Joachim,

Unfortunately Lab is not ideal either, because (and I quote Bruce Lindbloom here) " it was designed to measure color differences. It was not designed to have the perceptual qualities needed for gamut mapping. Its use for this purpose is really a misuse, resulting primarily from a lack of a better alternative". The consequence is e.g. the notorious Blue turns purple issue.

What that means is that, besides the loss of certain color nuances when converting in and out of Lab, there can be color shifts, e.g. blue sky can turn purple-ish.

Here's a simple experiment to illustrate the potential issue with Lab mode.
Download this small file: http://www.xs4all.nl/~bvdwolf/temp/OPF/B2P-test.tif

It is a simple gradient made with a method similar to the one used in the DPReview thread, with RGB blending at gamma 1.00 disabled, as you suggest. Now convert the mode from RGB to Lab, don't flatten the layers, and as if out of the blue (pun intended) purple was introduced. Now convert back to RGB mode, and part of the magenta is gone, but not all. The result is blue with a permanent magenta cast that varies with Luminosity. Also blends that originated in Lab and that were converted to RGB mode will exhibit a magenta shift of blues.

Cheers,
Bart
Reply With Quote
  #17  
Old August 16th, 2010, 08:05 AM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default

Hi, Bart,

Quote:
Originally Posted by Bart_van_der_Wolf View Post
Hi Joachim,

Unfortunately Lab is not ideal either, because (and I quote Bruce Lindbloom here) " it was designed to measure color differences. It was not designed to have the perceptual qualities needed for gamut mapping. Its use for this purpose is really a misuse, resulting primarily from a lack of a better alternative". The consequence is e.g. the notorious Blue turns purple issue.
Indeed. This is in part a result of the fact that the a*-b* plane is a plane of chrominance, not chromaticity.

That is, a certain a*-b* pair will represent different chromaticities when found in connection with different values of L*.

Of course, this is not the only issue behind the problem you mention.

Best regards,

Doug
Reply With Quote
  #18  
Old August 16th, 2010, 11:35 AM
Joachim Bolte Joachim Bolte is offline
Member
 
Join Date: Aug 2010
Posts: 151
Default

Well, but then you should be aware that the purple is there in the RGB also... Without doing anything to the file, drop the opacity of the white layer to 20%, so the blending shifts a little, and you will see them appearing on the left-bottom quadrant. Pull your eyedropper over it, you will see that the color holds blue (offcourse), but also more red than green... to my knowledge that's purple...

Lab just has more room to display those purples... that can be a problem, I admit, but if you know what to be aware of, there is no problem at all.

As said, Lab is not the holy grail of editing. For some tasks it really stands out, for others it sucks. But there is a reason that it is a reference space, it handles colors much more naturally than RGB or CMYK
Reply With Quote
  #19  
Old August 16th, 2010, 12:28 PM
Bart_van_der_Wolf Bart_van_der_Wolf is offline
pro member
 
Join Date: Jun 2006
Location: Netherlands
Posts: 4,046
Default

Quote:
Originally Posted by Joachim Bolte View Post
Well, but then you should be aware that the purple is there in the RGB also... Without doing anything to the file, drop the opacity of the white layer to 20%, so the blending shifts a little, and you will see them appearing on the left-bottom quadrant. Pull your eyedropper over it, you will see that the color holds blue (offcourse), but also more red than green... to my knowledge that's purple...

Lab just has more room to display those purples... that can be a problem, I admit, but if you know what to be aware of, there is no problem at all.
Hi Joachim,

The issue starts with blending at gamma 2.2, that's why colors go out of whack. The individual gradients are pure, Gray and shades of Blue, no magenta involved. The shift in Lab mode is only adding to the problem. You can easily spot the pending trouble with the following experiment:

Start in the color picker and define e.g. a foreground color of pure blue R=0, G=0, B=255. No magenta, nothing but Blue:



Then change the L of the Lab controls from 0 to e.g. 54:



Oops, that wasn't what we wanted, a shift to magenta again. Now try moving that L back to 0:



The shift is still there, Blue is desaturated and darker and Red has crept in, and we even didn't have to switch to Lab mode ...

I'm not saying there is no possible way to deal with it, but we should be aware of the issues and not create, or cascade them, but rather avoid them. Blending colors is fraught with potential problems, with color and brightness, but the issues are easily avoided. Photoshoppers beware, that's all I'm saying.

Cheers,
Bart
Reply With Quote
  #20  
Old August 16th, 2010, 02:56 PM
Joachim Bolte Joachim Bolte is offline
Member
 
Join Date: Aug 2010
Posts: 151
Default

Sure, that's 'translation' trouble between colorspaces. if you would make the same setup in Lab, using the color that Lab describes as the purest blue (with b at -127 and no magenta in a), you'd get a much better result than working in RGB where there is still a hint of red in the gradient.

But back to the main subject: Why would you use gamma 1.0 if your eyes are used to gamma 2.2? The colors the gradient uses don't change, they just get shifted across... Could you show me how to make a CORRECT direct gradient from green to magenta in RGB, one that doesn't travel trough grey or purple or some other unpredictable color but follows the spectrum and where there is a nice flow between the luminocities of the two 'mothercolors'... you can use gamma 1.0 if you think that helps.

Me for myself, I think you can't do that in RGB
Reply With Quote
  #21  
Old August 16th, 2010, 03:26 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default

Let me prattle a little about some of the theory involved here (as is my wont).

Suppose we have two light sources of different color, and let's consider those colors to be described on a luminance-chromaticity basis (as is not true of any color space with which we normally deal in practical digital photography). One specific color space of that genre is the CIE x-y-Y color space. (I know the notation seems peculiar - but the story is a long one.)

Here, Y represents the luminance of the color - the property that describes its perceived "brightness". However, it is not true that double the value of Y means double the perceived brightness. I won't pursue that complication further for the moment.

x and y together describe the chromaticity of the color - the property that, qualitatively, distinguishes "red" from "blue", and distinguishes "red" from "pink".

We can graphically show the chromaticity aspect of any color as a point on the CIE z-y plane (the plane on which we most often see the famous "spectral horseshoe" drawn). Luminance can be thought of as being on the Y axis, which is perpendicular to the x-y plane. We sometimes see a figure that is intended to be a "perspective" or "oblique" presentation of this three-dimensional space, but most often we just deal with the x-y plane.

Suppose now that we have two "sources" of light, with different colors, that are to be "mixed". What is the color of the composite light?

Its luminance is the sum of the luminance of the two components. (Simple enough. To make this so is one reason luminance is defined the way it is.)

What about its chromaticity? If we plot on the x-y plane the chromaticities of the two components, draw a line between them, and find the center of the line (that's because the two components have equal luminance - we want the point equidistant from the two chromaticity points). That is the chromaticity of the composite light. Neat.

Now imagine that we have two light components, A and B, of different color, and that the luminance of A is twice that of B. As we might suspect, the luminance of the composite is just the sum of the two component luminances. But what about the chromaticity of the composite?

As before, we plot, on the x-y plane, the chromaticities of A and B. We draw a line between them. We find on that line the point that is 1/3 of the distance from A to B. That represents the chromaticity of the composite light.

The reason is simple. Since A has twice the luminance (potency) of B, it has twice as much influence on the composite chromaticity as B. Thus, the "result" is "twice as close to A as it is to B (half the distance).

And of course one of the reasons x and y are defined the way they are (we never described that, of course) is so it will work that way. (Well, how thoughtful of those old guys with the long beards!)

Now we move to another color space, in which a color is described as a recipe which states amounts of three composite colors called primaries. Often these primaries are called "R", "G", and "B", since their chromaticities are what we might call "red", "green", and "blue. Of course for any specific such color space, we must define precisely what the chromaticities of the three primaries are. And we can plot them on the x-y plane (as we often see).

The description of a color is then in terms of three numbers, giving the "potency" of the three primaries that, if combined, will form the color. We'll call those numbers r, g, and b.

These are not the values R, G, and B used in color spaces such as sRGB. Those values are non-linear forms of r, g, and b. This nonlinearity is sometimes spoken of as gamma precompensation, and the reader is likely familiar with the concept, which I won't belabor here.

Now, suppose we have again two light sources, whose colors we know in terms of r, g, and b values. These numbers contemplate specific primaries, R, G, and B, with known chromaticities, and in fact we have those chromaticities plotted on our x-y plane. We'll call those points Rp, Gp, and Gp. (They are usually labeled just R, G, and B, but I want to reserve those designations for the numbers used in the sRGB color space, which we aren't talking about yet.)

Now, how do we find the chromaticity of the composite light? We look for a point so that the inverses of its distance from Rp, Gp, and Bp are proportional to its values r, g, and b. Simply, the point is "drawn to the chromaticity point of a primary" more strongly the higher its value for that. In the special case where r=g=b, the point would be equidistant from the points Rp, Gp, and Bp.

Now, suppose that in an image editing program, we want to calculate the result of the compositing of light of two colors ("blending" is a common general term for that). If we have the r, g, and b values of the two colors, the calculation is simple algebra, and will produce the r,g,b description of the actual color that would result if we really combined light of those two colors.

Now, suppose we have the colors of the two colors in terms of R, G, and B, which are nonlinear transforms of r, g, and b. Suppose that we use those in the same algebra, to get an R, G, and B value that we use as if it were the description of the composite color. But it isn't.

Still, that is typically how an image processing program proceeds.

To get the R,G,B description of the composite color, we must:

Convert R to r, G to g, and B to b.
Do the "combining" algebra with r, g, and b to get an r, g, and b description of the color of the composite light.
Convert r, g, and b to their nonlinear forms (R, G, and B). Then display (or whatever) that color.

Can we obligate Photoshop to proceed that way? Evidently, apparently by calling for "blend with gamma=1". (Gamma=1 is a way to say "no nonlinearity".)

Those who work with professional video systems may recognize the term "linear light processing". That is the same concept at work.

Best regards,

Doug
Reply With Quote
  #22  
Old August 16th, 2010, 05:00 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default

I don't know how I got into that long theoretical discussion. A much more direct discussion would suit the issue here. So let me do that. I've left the original one up, as it is perfectly valid, and some of it might be of interest.

************

In a "tristimulus" color space, of which our familiar sRGB space is a particular form, a color is described as a recipe involving three colors called primaries (such as the ones we call called "R", "G", and "B").

The description of a color is then in terms of three numbers, giving the "potency" of the three primaries that, if combined, will form the color of interest. We'll call those numbers r, g, and b.

These are not the values R, G, and B used in color spaces such as sRGB. Those values are non-linear forms of r, g, and b. This nonlinearity is sometimes spoken of as gamma precompensation, and the reader is likely familiar with the concept, which I won't belabor here.

Now, suppose we have two light sources, whose colors we know in terms of r, g, and b values, and they are to be "combined". How do we find the color of the composite light?

It's very simple. Each of its coordinates, r, g, and b, is just the sum of the two corresponding values of the two component colors.

But, in our image editing programs, we have the colors of the two colors in terms of R, G, and B, which are nonlinear transforms of r, g, and b. Suppose, when we are "blending" two component colors, we add their R values, the G values, and the G values, to get a new set of R, G, and B. Will those be the R,G,B representation of the composite color? No.

Still, that is typically how an image processing program proceeds.

To get the actual R,G,B description of the composite color, we must:

Convert R "back to" r, G to g, and B to b.

Add the r, g, and b values of the components, which gives the r, g, b description of the composite color.

Convert r, g, and b to their nonlinear forms (R, G, and B). Then display (or whatever) that color (as we would for any R,G,B description).

Can we obligate Photoshop to proceed that way? Evidently, apparently by calling for "blend with gamma=1". (Gamma=1 is a way to say "no nonlinearity".)

Those who work with professional video systems may recognize the term "linear light processing". That is the same concept at work.

Best regards,

Doug
Reply With Quote
  #23  
Old August 16th, 2010, 11:51 PM
Joachim Bolte Joachim Bolte is offline
Member
 
Join Date: Aug 2010
Posts: 151
Default

OK, so much for the theoretical explanation, in which you again pull color and chromacity apart, something that (for my knowledge) can't be done in RGB (or rgb for that matter). but now please show me the correct (linear or non-linear, whatever you like) transition between cyan (0,255,255)and red (255,0,0), made in an RGB colorspace. The colors have to follow the logical path (so not through grey or purple or something), and the lightness-values (to follow the PS-lingo) may not have a drop or hump across the gradient apart that what comes with the non-linearity using gamma 2.2.

PS: You use the words 'now, suppose' a lot! :)
Reply With Quote
  #24  
Old August 17th, 2010, 05:28 AM
Bart_van_der_Wolf Bart_van_der_Wolf is offline
pro member
 
Join Date: Jun 2006
Location: Netherlands
Posts: 4,046
Default

Quote:
Originally Posted by Joachim Bolte View Post
OK, so much for the theoretical explanation, in which you again pull color and chromacity apart, something that (for my knowledge) can't be done in RGB (or rgb for that matter). but now please show me the correct (linear or non-linear, whatever you like) transition between cyan (0,255,255)and red (255,0,0), made in an RGB colorspace. The colors have to follow the logical path (so not through grey or purple or something), and the lightness-values (to follow the PS-lingo) may not have a drop or hump across the gradient apart that what comes with the non-linearity using gamma 2.2.
Hi Joachim,

If I understand you correctly, what you would like to see is a physical impossibility, because human vision experiences different colors at different brightnesses. Nevertheless, one can approximate what you are looking for by using the gradient tool and force it to follow not a direct transition from Cyan to Red (which is what happens when you blend the light of 2 lightsources) but do so by changing the hue angle.

This is a direct blend of 2 light sources, but without gamma compensation


This looks strange, because when we add the light of 2 lightsources, things get brighter, not darker.

Therefore, here is the gamma compensated version



Now, let's assume we want to follow a path along spectral hue angles. There are 2 possibilities, a natural one,
without

and with gamma compensation


Due to the 4 images per post limit, continued in the next post ...

Last edited by Bart_van_der_Wolf; August 17th, 2010 at 08:36 AM.
Reply With Quote
  #25  
Old August 17th, 2010, 05:34 AM
Bart_van_der_Wolf Bart_van_der_Wolf is offline
pro member
 
Join Date: Jun 2006
Location: Netherlands
Posts: 4,046
Default

Due to the 4 images per post limit, continued from the previous post.

... and one via a non-natural/spectral Magenta color, but quite possible when mixing light




There may be some color frequencies that appear a bit darker or lighter than their neighbors, but that has to do with human vision, and the limitations of RGB displays. If desired, one can apply 'corrections' by adding a luminosity layer and tweaking that at will.

The gradients were made with the PS gradient tool, on a layer without transparency. Therefore there was neither layer blending involved, nor an effect from the gamma blending option, so the blending between colors had to be adjusted with a Levels gamma adjustment of 2.20. The results are reasonably uniform in brightness (check with the HSL info display). Choosing less saturated colors for the gradient tool would allow more control for subsequent tweaking of the luminosity levels, should one desire to do that to obtain even more uniform luminosity along the gradient.

Hope that sheds some 'light' on the matter.

Cheers,
Bart
Reply With Quote
  #26  
Old August 17th, 2010, 06:46 AM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default

Hi, Joachim,

Quote:
Originally Posted by Joachim Bolte View Post
OK, so much for the theoretical explanation,
Always a great way to start a conversation with me!
Quote:
. . . in which you again pull color and chromacity apart, something that (for my knowledge) can't be done in RGB (or rgb for that matter) . . .
I don't know what you mean by that.
Quote:
. . . but now please show me the correct (linear or non-linear, whatever you like) transition between cyan (0,255,255)and red (255,0,0), made in an RGB colorspace. The colors have to follow the logical path (so not through grey or purple or something), and the lightness-values (to follow the PS-lingo) may not have a drop or hump across the gradient apart that what comes with the non-linearity using gamma 2.2.
The result of blending light of color RGB 1, 255, 255 with light of color RGB 255,0,0, in the sRGB color space (there is no specific color space called "RGB") for a progression of six different proportions, would be as follows (please excuse the use of the "code" format; it is the only way I know to get true fixed-width character spacing with all spaces presented):
Code:
    Proportion of     Coordinates of "mixed" color
0,255,255  255,0,0        R       G       B    Relative luminance*

  0%       100%              0    255    255           0.783  
 20%        80%            124    232    232           0.678          
 40%        60%            170    204    204           0.561
 60%        40%            204    170    170           0.445
 80%        20%            232    124    124           0.330
100%         0%            255     0     0             0.213
* Color 255,255,255 would have relative luminance= 1.000

Note that in doing this I do not have the liberty of imposing the restrictions you give - the mixtures will be what they will be.

This relies on the following table of R,G, or B vs. r, g, or b (the "linear" equivalents); r/g/b are on a scale of 0-1.

Code:
R/G/B         r/g/b

  0            0.0
124            0.2
170            0.4
204            0.6
232            0.8
255            1.0
Best regards,

Doug
Reply With Quote
  #27  
Old August 17th, 2010, 06:54 AM
Joachim Bolte Joachim Bolte is offline
Member
 
Join Date: Aug 2010
Posts: 151
Default

OK, but for the gradients along the spectral hue angles, you did not just use only the cyan and red swatch, but you forced it along yellow or purple with a middle swatch, didn't you?

Doing that you just show that RGB (or rgb) and it's standard mixing modes don't do a very good job in blending colors. Sure you can mute that effect by changing the gamma, but the only thing you do is make it less noticable, you don't improve it.

The middle bottom example is exactly what Lab cyan to red would give you... Not that you would see a cyan to red blend very often in real life, but the blend is a lot more natural, and for me it's a big plus for using Lab instead of using linear gamma in RGB.
Reply With Quote
  #28  
Old August 17th, 2010, 07:05 AM
Joachim Bolte Joachim Bolte is offline
Member
 
Join Date: Aug 2010
Posts: 151
Default

Quote:
Originally Posted by Doug Kerr View Post
Code:
   Proportion of     Coordinates of "mixed" color
0,255,255  255,0,0        R       G       B    Relative luminance*

  0%       100%              0    255    255           0.783  
 20%        80%            124    232    232           0.678          
 40%        60%            170    204    204           0.561
 60%        40%            204    170    170           0.445
 80%        20%            232    124    124           0.330
100%         0%            255     0     0             0.213
* Color 255,255,255 would have relative luminance= 1.000

Doug
So if I understand correctly, at 50% blend you would get a nice, medium Gray, when all the values are identical.... :)

How did you calculate the relative luminance of the resulting colorsteps? And when bright red has a lower Rl than bright cyan, does that mean red appears about 2/3 darker to the eye? Because it does not seem to be that way... You will notice that on the upper two examples Bart posted.
Reply With Quote
  #29  
Old August 17th, 2010, 07:14 AM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,428
Default

Hi, Joachim,

Quote:
Originally Posted by Joachim Bolte View Post
OK, so much for the theoretical explanation, in which you again pull color and chromacity apart, something that (for my knowledge) can't be done in RGB (or rgb for that matter). , ,
Let me respond to this here; I didn't want to in my earlier message so as not to disrupt the actual presentation.

I don't know what you mean "pull color and chromaticity apart". One can pull color apart into luminance and chromaticity. (You may have meant to say that.)

By that I mean that any color (no matter in which form we have it described; that is, in terms of what color space) can be expressed in terms of the two properties luminance and chromaticity.

There are two ways to express luminance:
In absolute terms (in candelas per square meter)
In relative terms (on a scale of 0-1) (we most often do that in our work)

There are several ways to express chromaticity (all involving two values); one that is widely used in scientific work is the CIE x-y system. It is that notation that is used on the familiar "chromaticity diagram".

You are quite right that the sRGB color space (or any other RGB-family color space) gives us no visibility of those properties (which I suspect is your point). The same is in fact true for any color space we work with in digital photography. (The L*a*b* color space gives us visibility of something somewhat like luminance, as its L* coordinate.)

However, for any color, perhaps known to us in terms of the RGB coordinates of the sRGB color space, has those two properties. They can be rigorously calculated from the values of R, G, and B.

Note that to rigorously determine the sRGB representation of the combination of two "lights" described in terms of sRGB, we need not calculate the luminance and chromaticity (perhaps in terms of x and y) of the two ingredients. We merely need to convert the nonlinear RGB values into the corresponding "linear" values (for which I, here, use the symbols r, g, and b), add them from the two ingredients, and then convert the result back into nonlinear form (as the values R, G, and B).

Best regards,

Doug
Reply With Quote
  #30  
Old August 17th, 2010, 07:34 AM
Joachim Bolte Joachim Bolte is offline
Member
 
Join Date: Aug 2010
Posts: 151
Default

You're totally right, I mixed them up. I meant the luminocity that is coupled with the chromacity, the color info.

As long as you make a logical transition (f.e.) red to black, the both will follow along the expectations. But if you try something more out of the ordinary, strange things start to happen. the rgb-values try to follow a linear path, thus changing the luminocity AND color information at the same time, and creating colors that can have illogical apparent lightnesses, compared to their mother-colors. Or we can create a gradient that has perfect apparent lightness, but the colors are 'wrong' to the viewer.
And again, in the example Bart made you will see that the standard blend method in sRGB is right through the grey centre of things, and 50% grey looks darker than either red or cyan. It does so with or without gamma-correction, and it is not pleasing to look at.

And face it, what do we want when we use photoshop? A mathematically correct color, or one that looks good? Preferrably both, but If I have to choose, and I'm working with media that have to be viewed, I tend to go for the latter category.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 Off
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Color Management and Adobe Photoshop Nigel Lew Printing 16 April 15th, 2011 10:59 AM
Photoshop - character '' in Exif metadata Doug Kerr Image Processing and Workflow 6 June 10th, 2010 08:57 AM
Photoshop - encoding of copyright symbol in metadata Doug Kerr Image Processing and Workflow 6 May 17th, 2010 02:40 PM
IMPORTANT NEWS: Photoshop CS4 to support 64bit on windows only Ivan Garcia Breaking News 1 May 17th, 2008 10:42 AM
CS3 is expected to ship by end of April 2007 Nicolas Claris Breaking News 6 March 28th, 2007 03:22 PM


All times are GMT -7. The time now is 09:39 PM.


Posting images or text grants license to OPF, yet of such remain with its creator. Still, all assembled discussion 2006-2017 Asher Kelman (all rights reserved) Posts with new theme or unusual image might be moved/copied to a new thread!