• Formula for Levels adjustment (midpoint only)?

# Formula for Levels adjustment (midpoint only)?

Explorer ,
Jun 07, 2022 Jun 07, 2022

Copied

Before someone points me to it, YES, I’ve seen this thread https://community.adobe.com/t5/photoshop-ecosystem-discussions/question-on-the-gamma-mid-tone-value-...

But I can’t get it to work on MY numbers... I’m just trying to communicate to some folks who are coding a GUI for me where some colors are generated from one base color choice — and I’ve achieved what I want VISUALLY by using a levels adjustment layer and changing the midpoint fom 1 to 0.6, with these channel values and the results:

R 30 -> 48

G 46 -> 78

B 78 -> 123

I’ll be honest: I went to art school 34 years ago to AVOID math. Earlier, trying to see if a solution using the (mathmatically) much simpler Multiply blend mode would work, I was pushing my limits. So it’s possible that the above thread DOES solve my problem, but I’d like to be able to duplicate the results myself before suggesting that someone else use it.

Thanks in advance! In a little bit of a rush here,

TOPICS
Actions and scripting

Views

76

Likes

Report

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

Adobe Community Professional , Jun 07, 2022 Jun 07, 2022
But — maybe I’m just not doing it right — ((48/255)^(1/0,6))*255 = 15.77 (not 30) By @scabbot610
How did you get 30 out of 48? Show it in a screenshot analogous to mine.

Likes

6 Replies 6
Jun 07, 2022 Jun 07, 2022

Copied

I want VISUALLY by using a levels adjustment layer and changing the midpoint fom 1 to 0.6, with these channel values and the results:

R 30 -> 48

G 46 -> 78

B 78 -> 123

By @scabbot610

I didn't quite understand what that means. If you reduce the gamma (midpoint), then the values in the channels should also decrease.

Can you describe the desired result in more detail, or illustrate it with a screenshot?

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Jun 07, 2022 Jun 07, 2022

Copied

I don’t think it will take a screenshot, just maybe a shorter description, because the visual really won’t demonstrate anything I can’t describe. But let me try a list:

• 1) I have someone else creating some code that has to, among lots of other things, make a color adjustment to a color that was chosen by a user
•  2) That adjustment has to be made on-the-fly ouside of Photoshop
• 3) In Photoshop, I’ve achieved the color shift that I want, simply by changing the gamma to 0.6
• 4) In order to tell the coders what I want to happen, I have to to describe the mathematical operation the code will need to run. I don’t want to just send them an example and say “make it like this, but for every possible color.”
• 5) Which is why I’m looking for an algorithmic solution.
• 6) Unfortunately, when I do the math that I think is being shown on the other thread, I get numbers that are nothing like the ones that I’m actually getting in Photoshop. For example:
• Using RGB values 48/74/123 and
• Applying a gamma shift to 0.6
• The resulting PS values are 30/46/78.
• But — maybe I’m just not doing it right — ((48/255)^(1/0,6))*255 = 15.77 (not 30)

Does that make more sense? Sorry for using a bulleted list plus numbers BUT the formatting for a numbered list doesn’t indent at all (at least not in my browser).

Thanks again!

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Jun 07, 2022 Jun 07, 2022

Copied

(seriously, I can’t edit or delete my own post? What the heck?)

Obviously, I mistakenly reversed the order of the pre- and post- gamma change numbers, they DID reduce as illustrated in my most recent example!

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 07, 2022 Jun 07, 2022

Copied

* didn't see similar @r-bin post because before posting was trying to figure out if the values were affected by the color space tone correction curve and the screen proof settings. No, they don't.

Are you using a single color fill document or an image with multiple colors? Could it be that near of the place where you measure the color there are shades of a different brightness and at the same time in the eyedropper settings you have a large sample size (i.e. it captures not a specific measurement point, but neighboring pixels)?

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 07, 2022 Jun 07, 2022

Copied

• But — maybe I’m just not doing it right — ((48/255)^(1/0,6))*255 = 15.77 (not 30)
By @scabbot610

How did you get 30 out of 48? Show it in a screenshot analogous to mine.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Jun 07, 2022 Jun 07, 2022

Copied

LATEST

AHHHH SO SORRY for wasting your time... there was a color fill layer set to Overlay ABOVE it.

Thanks for your patience and all of your hard work. I can’t believe I missed that.  😞

(...of course now it will probably take more than a levels adjustment to get what I want, lol)

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources