Add a check to see if the directory to which we are writing the image exists. Exit otherwise.
Add a check to see if the directory to which we are writing the image exists. Exit otherwise.