Sign in to follow this  

Photoshop Adjust Brightness algorithm

This topic is 3861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is the algorithm? When you brighten a dark image, it increases the luminosity of dark pixels much more than the bright ones. The bright pixels are not allowed to reach or surpass full white. Thanks,

Share this post


Link to post
Share on other sites
All it does is shift the luminosity histogram over.

The amount -100..0..+100 is the amount of the shift (where the historgam exists from 0..255). So, it has nothing to do with a %. It's just -100..100 of 255.

Share this post


Link to post
Share on other sites
Are you having a conversation with yourself?

All that's going on is a reversible luminosity transformation. Convert the image to YCC, process the Y-component then convert back.

One way to preserve relative luminosity, in a sense, is to scale the luma to the range [0, 1] and raise it to a power 0 < l < 1 (l > 1 corresponds to darkening). This will keep black black, white white, and map distinct values to distinct values. I used a power, 'cause it seems appropriate, but you could employ any strictly increasing gain curve spanning the range. Many tools allow you to define your own such gain curve using B-splines.

Admiral

Share this post


Link to post
Share on other sites
Yes, I find me talking to myself often ;)

Actually, all Photoshop does is take the x = -100..+100 brightness adjustment value, and add this to R, G, and B! With no regard that the hues will change (due to the RGB values of a particular pixel having new relative values to each other).

This means that the luminosities are not even being incremented by any type of scaling method as you mentioned. Assuming gamma = 1, they all get incremented by the same absolute luminosity, assuming they don't go out of 0..255 range.

I thought the same thing as you, I wanted black to stay black, white to be white, and all colors between black and white to *remain* between black and white (to avoid white-out or black-out, whatever the terms are), and for them to remain in proper sequence. A power function is what I had in mind, too.

But, after careful analysis to find out just what the power function was, I determined the luminosity histogram is merely shifted. During my calculations of how to make this happen, I realized the simple truth... During my Google search, I actually ran across a site with code that does just this simple algorithm, and immediately dismissed it as being 'obviously wrong'. :)

Thanks, Admiral

Share this post


Link to post
Share on other sites
Quote:
Original post by Jason Doucette
Actually, all Photoshop does is take the x = -100..+100 brightness adjustment value, and add this to R, G, and B! With no regard that the hues will change.

Really? That's crap.
I can't afford Photoshop ([crying]) but I'm at least glad that Paint Shop Pro handles matters more appropriately [razz].

Admiral

Share this post


Link to post
Share on other sites
I don't want to defend PhotoShop but there are several other methods to adjust the brightness.

A few that comes to mind directly are:

"Image\Adjustments\Hue/Saturation" that allows you to adjust the lightness value (scaling the L in HSL space for each pixel).
"Image\Adjustments\Curves", wich allows you to edit the brightness curve where you can do a power curve and a whole lot of other funky things.
"Image\Adjustments\Variations", wich has a lighter function (dunno how it works).

There are also many other ways to do it of course.

[Edited by - eq on May 22, 2007 4:03:57 AM]

Share this post


Link to post
Share on other sites
Ok, thanks, eq. I think all of those methods are for specific situations. For example, "Curves" is likely when you specifically want a certain dark section of the range to be brighter (that is, you want fine control). I was just looking for a generic algorithm that could be applied to many images, and I believe that's what the Adjust Brightness feature is for. But, thanks for mentioning the other options.

Share this post


Link to post
Share on other sites

This topic is 3861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this