Added code to save image to a file