added save image functionality