added function for reading images