add env function to process a whole directory with image files