Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Question on the Gamma(mid-tone) value in levels adjustment layer

Engaged ,
Jan 20, 2020 Jan 20, 2020

Hi EveryOne!,

I have few clarifications on the Gamma(mid-tone) adjustment of levels using photoshop

Please find the screenshot for more reference

The first screenshot shows the middle slider value is 1 and ColorSampler red value is 154

Once I change the ColorSampler red value is 84 and the middle slider value changed into 0.46

Is there is any formula available PS object model?

Or any suggestion to calculate?

Could anyone please help me to resolve the issue. 

-yajiv

 

 

1.png

2.png

 
 
 
TOPICS
Actions and scripting , Windows
3.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Mentor , Jan 21, 2020 Jan 21, 2020

This is the gamma-compensation function: x ^ (1 / gamma). It uses to describe how human perceives a different values of brightness

* gamma is the coefficient you see in the panel

* all brightness values should be reduced to relative (0-255)/255

 

for example  = 154 - (154-((154/255)^(1/0,46)*255)) = 85,19

* I don’t know why there is a difference in rounding - most likely Adobe uses a rougher calculation to speed it up. To check, you can try on other values of the coefficients:

 

0,17: 154 - (154-((154/

...
Translate
Mentor , Jan 21, 2020 Jan 21, 2020

Before i accidentally added unnecessary elements to the solution of the original formula: Y = x ^ (1 / G). In numerical form it can be represented much easier: Y = ((154/255)^(1/0,46))*255 = 85.12

 

If we need to find G from the equation Y = x ^ (1 / G), then it will take the following form: G = LOG(X)/LOG(Y). In numerical form it can be represented as: G = LOG(154/255)/LOG(85/255) = 0.459 

 

Here is the link to google sheets: sample

 

1. Value from gamma
 
Input (X) 154
Gamma (G) 0,4
...
Translate
Adobe
Mentor ,
Jan 21, 2020 Jan 21, 2020

This is the gamma-compensation function: x ^ (1 / gamma). It uses to describe how human perceives a different values of brightness

* gamma is the coefficient you see in the panel

* all brightness values should be reduced to relative (0-255)/255

 

for example  = 154 - (154-((154/255)^(1/0,46)*255)) = 85,19

* I don’t know why there is a difference in rounding - most likely Adobe uses a rougher calculation to speed it up. To check, you can try on other values of the coefficients:

 

0,17: 154 - (154-((154/255)^(1/0,17)*255)) = 13,12

2020-01-21_15-15-42.png

 

2.76: 154 - (154-((154/255)^(1/2,76)*255)) = 212,41

2020-01-21_15-19-16.png

etc..

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 21, 2020 Jan 21, 2020

May I know where have you found information about this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jan 21, 2020 Jan 21, 2020

I do not remember 🙂
Many years ago I read a book on the operation of CRT-displays and there was an example of signal conversion with this (or similar) function. It was used both for display on the screen and for encoding the brightness levels in the file.This was explained as close adaptation to the characteristics of human vision. Then I noticed that it is identical to the one used in the level, curves toos and exposure in camera raw - since then it’s in my head 🙂

 

May be there - The rehabilitation of gamma (but most likely not)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 21, 2020 Jan 21, 2020

DmitryEgorov,

Thank your detailed explanation. it is really appreciated

85= 154 - (154-((154/255)^(1/0.43)*255))
85= 154 - (154-((154/255)^(1/G)*255))

then How do we find the G value?

 

-yajiv

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jan 21, 2020 Jan 21, 2020

Before i accidentally added unnecessary elements to the solution of the original formula: Y = x ^ (1 / G). In numerical form it can be represented much easier: Y = ((154/255)^(1/0,46))*255 = 85.12

 

If we need to find G from the equation Y = x ^ (1 / G), then it will take the following form: G = LOG(X)/LOG(Y). In numerical form it can be represented as: G = LOG(154/255)/LOG(85/255) = 0.459 

 

Here is the link to google sheets: sample

 

1. Value from gamma
 
Input (X) 154
Gamma (G) 0,46
Output (Y) 85,19437485
   
2. Gamma from value
 
Input (X) 200
Value (Y) 220
Gamma (G) 1,645575473
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 21, 2020 Jan 21, 2020
LATEST

Hi DmitryEgorov,

Thank you so much for the detailed explanation. 
your timely help much appreciated.

 

-yajiv

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 21, 2020 Jan 21, 2020

I remembered your avatar from some past and checked you showed up again after nearly 2 years 😉

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 21, 2020 Jan 21, 2020
var input_low   = 0;
var gamma       = 0.46
var input_high  = 255;

var output_low  = 0;
var output_high = 255;

var input = 154;

output = Math.pow((input - input_low) / (input_high - input_low), 1/gamma) * (output_high - output_low) + output_low;

alert(output);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines