create readImages func