save the image into a file