To read image and convert it to grayscale