Copy link to clipboard
Copied
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
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/
...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 |
Copy link to clipboard
Copied
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
2.76: 154 - (154-((154/255)^(1/2,76)*255)) = 212,41
etc..
Copy link to clipboard
Copied
May I know where have you found information about this?
Copy link to clipboard
Copied
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)
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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 |
Copy link to clipboard
Copied
Hi DmitryEgorov,
Thank you so much for the detailed explanation.
your timely help much appreciated.
-yajiv
Copy link to clipboard
Copied
I remembered your avatar from some past and checked you showed up again after nearly 2 years 😉
Copy link to clipboard
Copied
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);