Calculate average brightness of image