this method of saving the image causes chrome to crash sometimes