add try-except loop on image reading