Understand gamma

Hi All,
excuse for my english language; is not my first language…
I’m in to understand the “gamma”. I know it’s a non linear response to an input signal; in this case a power function where the input lower values are more amplified then the higher. In this manner because the monitor has a inverse response the final result in linear. OK I saw RT can save images with more gammas and I tried to do it with two RAW images;one saved with the lower gamma 1 and the other with the higher gamma 3.5.
But when I open the two images they are the same… I expected the one with gamma 3.5 would be been more bright into low lights… Do I missed something?? Do I be out of road??

Another question… what is the slope in gamma ?? We can speak of slope with logarithmic curve only??

Cheers

What application are you using to view your tif images afterwards? Is it color managed?

Hi, I use rawtherapee and gimp all color managed. With gimp I view the difference only if I disable color management.

Gamma is a little more complicated than that. in a nutshell it’s down to us seeing brightness variations logarithmically and cameras seeing it linearly. However there are complications because displays behave in a different fashion as well and it seems certain gamma values appear better when viewed in true colour as sRGB is has been called in the past. This page explains it well but probably wont clear things up completely.

http://www.cambridgeincolour.com/tutorials/gamma-correction.htm

Probably the best way for you to adjust gamma is to use levels in the GIMP. The net effects tends to be changes in mid tone contrast. If you find an editor that allows you to actually manipulate the curve that is far more noticeable.

John

Hi John,
I know the matter is very complex and I am afraid I ask stupid questions… But… I do try.

I Didn’t understand if there are more gammas: that one which is loaded into video card lut by the CMS and the one which is coded into Rgb profile to enhance low lights bit depth which is decoded before to send Rgb values to the adapter.

Excuse me but I try to light some my doubts…

My first language is Swedish. What is your first language? Hm, let me guess: Italiano? Mi italiano solo poco poco – but that has never stopped me from trying to communicate :slight_smile:

Please do not be afraid to ask questions!

Will this information help you?
http://www.poynton.com/notes/colour_and_gamma/GammaFAQ.html#gamma

Cordialmente,
Claes

Hi Claes,
you guessed!!
Ok, I try to read that …

Many thanks for now.

Hi @dafrasaga

Changing output gamma will not make a visible difference in the output image when it is opened in an external program as long as that image contains metadata (ICC profile) indicating the gamma, so that the program reading it decodes it correctly. As I understand it, posterization could become a problem at low bit depths depending on the gamma the actual data was encoded with.

sRGB gamma has two sections - the curved section has a gamma of 2.4, and there is a slope at the dark end which is linear. The overall gamma appears about 2.2.

See:
Gamma correction - Wikipedia
Color Management addon - RawPedia
sRGB - Wikipedia

Hi Morgan,
we see if I well understood … I can save with anything gamma… then the color management software knows the encoded gamma image, knows the monitor gamma profile and therefore the correct gamma is showed. Is it right??
Excuse my ignorance, but, if I work into a well color managed environment when do I choose a gamma instead of another??

Cheers

A gamma with big slope value gives more data density at the darks but less at midtone/highlights
i.e

  • srgb’s linear part slope is 12.32 and gives better tonality at the darks than rec 709 (slope 4.5), but worse at the midtones
  • pure gamma 2.2 gives more density at the extra darks than sRGB, less at darkish, then about equal at midtones and highlights …
    The ideal encoding tone curve would be the one that matches human perception …
    https://www.smpte.org/sites/default/files/23-1615-TS7-2-IProc02-Miller.pdf
1 Like

That was a good reference, thank you.

Hi Ilias,
excuse me but I’m very hard to understand… but if there is not difference between an image coded with gamma 1 and another with gamma 3.5 because the cms translate from encoded image gamma to display gamma where do I find the darks differences??
I tried to make a step gradient tiff image and saved with gamma 1 and gamma 3.5. When I open images into RT and set “use embedded if possible” in color management there is no difference . If I set no profile I can view the differences, but it’s non color managed aymore…

Do I missing something ??
Please , if it’s possible, explain me with simple words… I’m not a color management technical…

The difference is a technical one. A gamma curve will sacrifice some encoding precision in one end of the histogram to gain more in the other. With the usual >1 gamma you will get finer gradient steps in the darks while having bigger steps in the highlights. So in your example the images will look the same when color managed but might have different banding.

I personally don’t know why setting the gamma is an option in RT, I’d just stick to the default gamma as defined in the different color profiles. That being said, I understand that this is about the encoding of saved files and not a display gamma used to make linear files more pleasing to view.

There is no difference in color/contrast etc but there is a difference in posterization at the darks (and not only darks ,)

With 16 bit tiffs photos (i.e somehow noisy darks which is a kind of dithering) we can hardly see any difference in darks’ posterization even with gamma = 1, maybe a bit more with Adobe’s PS/LR which convert 16bit tifffs to 15-bit …
With clear synthetic pictures (no dither due to noise) posterization is easier to come up.

With low bit depth files (8-bit) the posterization is obvious with gamma=1 and even with sRGB gamma (12X denser sampling at the darks). Things get worse with jpegs where both the integer transform from RGB to Y’CbCr JPEG - Wikipedia inserts one more quntization step and then the compression increase posterization even more.

Play with the DNG + pp3 linked at Please add LogC export · Issue #3333 · Beep6581/RawTherapee · GitHub to see … save the cat with the above pp3 using various output gamma settings and color profiles then open in RT and brighten the shadows.
The mentioned rec2020_log icc is two posts before the link … it’s TRC has a linear part at the start (darks) with a slope = 64 i.e 64X denser sampling there making an 8 bit file to have equal density with 14 bit linear (gamma = 1, slope = 1)

1 Like

Hi,
I did and I was astonished, there’s a lot of difference in the darks…
Another question please…Firts I thought the output function of gamma was i.e. y=x^2.2, then I understand all is not a exponential function; there’s a linear behavior in the darks: some as sRGB has a slope of 12.92, others have a slope of 4.5.
Ok, is this slope a mathematical tangent ?? Isn’t it??
How much is the range in which is applied??

Many Cheers

Of course it’s much better at the darks as I used slope = 64 there instead of the slope = 4.5 that rec2020 use. But this means I stoled much more codes from midtones/highlights (for the case of 8 bit files, I left there only about 25 codes per stop ) which will possibly be problematic.

Yes gamma is a power function but with icc profiles we can describe a complex curve with 2D Luts (TRC curves) … i.e. not only a mix of linear + gamma but any curve. In my “rec2020log” TRC i used linear + log
Dowload the icc inspector http://www.color.org/profileinspector.xalter and doubleclick on xTRCs to see or export in txt format the TRCs of the various icc/icm profiles.

Yes the linear part must be tangenious on the curve. The applied range varies depending on the desing target and maths. For sRGB (8 bit) values smaller than 11 are linear (0.04045255) for rec701/2020 it’s linear for smaller than 21 (0.081255)

1 Like

Hi,
thanks to everyone.
Now I understood more about color management.

cheers

Gamma does cause some confusion. I thought that link I posted earlier would clear the main aspect up.

Our eyes are far more sensitive to low light level changes than an camera is so that aspect needs to be corrected. At high brightness levels the camera is more sensitive so it’s steps in brightness step levels are irrelevant as far as our eyes are concerned cause we wont see them. We see equal brightness changes when the light intensity changes roughly by a factor of 2. So taking a 10 bit camera as far as we are concerned equal brightness changes would go light levels of 1,2,4,8,16,32,64,128,256,512,1024 and so on for higher bit count cameras. As we would be unlikely to see a 1bit signal on a monitor it’s worse than that really. Gamma is all about providing a tonal range and gradation that is suitable for our eyes but in an 8 bit colour space that can only have 256 distinct values. So as far as our eyes are concerned that can only be 1,2,4,8,16,32,64,128,256. 8 stops effectively of equal brightness steps and not that many in practice. The bit counts from the camera have to be processed into these to give an acceptable tonal gradation. At one end there are too many steps and compared with our eyes no where near enough at the other end. That’s why cameras show shadows in our shots that we couldn’t see. HDR is needed to take care of that if needed as the camera can’t cover the range we can.

Some might say that some of the above has nothing to do with gamma but I’m trying to explain why.

The next thing is the value of gamma. Initially crt displays had a gamma of about 2.5 due to the way they work. Physics in other words. Mac chose to go for a gamma of 1.8. MS and HP later decided on 2.2. Both of those decisions were based on the final appearance of an image taken digitally or scanned from negative. The story goes that MS were not happy with the images they were getting out of super colour as they called it and HP came up with the processing that was eventually used. It’s become the standard and the value has a lot to do with the appearance of the final image as a camera can’t match our eye view in all circumstances.

:sleeping: All that might help or might not. In some ways it’s best to just accept it. The effective change messing with it is likely to be mid tone level contrast. In some ways that’s what it’s aimed at - to make that as good as it can be.

John