gam function

Gamma correction