Auto color balance algorithm

What calculation is the auto color balance performing on the channel histogram?

1 Like

You can find the relevant calculations in the source code of ContrastAdjuster:

I have to say though that I never understood the reasoning behind its behavior: when pressing the Auto button (in the B&C or Color dialogs) repeatedly, you get increasing contrast with each click, until at some point the min and max are reset.

Also: why is the macro recorder recording:

run("Enhance Contrast", "saturated=0.35");

which is not reproducing the exact result of the Auto button?


I guess this is one of the IJ1 mysteries that only @Wayne will be able to explain? :slight_smile:

1 Like

Thanks. That is what I needed to know. I’ll only “press” the auto button once.