Creating functions to read the image files