Added code to create the output image directory