algorithm gets Image and Directory arguments