title: How can I save the screenshot image from the new window?
body: <p>The Google Chrome plug in opens the screenshot in a new window but how can it also save the image on my computer? How can the image over write itself every time when I run this script again? The code is made in Javascript.   </p>
  
  <pre><code>capturePage: function (position, lastCapture) {
  var self = this;
  
  setTimeout(function () {
      chrome.tabs.captureVisibleTab(null, {
          "format": "png"
      }, function (dataURI) {
          var newWindow,
              image = new Image();
  
          if (typeof dataURI !== "undefined") {
              image.onload = function() {
                  self.screenshotContext.drawImage(image, 0, position);
  
                  if (lastCapture) {
                      self.resetPage();
                      newWindow = window.open();
                      newWindow.document.write("&lt;style type='text/css'&gt;body {margin: 0;}&lt;/style&gt;");
                      newWindow.document.write("&lt;img src='" + self.screenshotCanvas.toDataURL("image/png") + "'/&gt;");
  
                  } else {
                      self.scrollTo(position + self.scrollBy);
                  }
              };
  
              image.src = dataURI;
          } else {
              chrome.tabs.sendMessage(self.tabId, {
                  "msg": "showError",
                  "originalParams": self.originalParams
              });
          }
      });
  }, 300);
  },
  </code></pre>