Using gamma correction to improve image quality