range bracketing and gamma correction