title: Javascript: Convert Canvas to Image in Chrome
body: <p>I have following code that works fine in IE but not in Chrome (Version 31.0.1650.63 m).<br>
  Error message: <em>Failed to execute 'toDataURL' on 'HTMLCanvasElement': tainted canvases may not be exported.</em></p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;img id="source" src="C:\test.jpg" /&gt;&lt;/br&gt;
  &lt;input type="button" value="convert" onclick="onClick()" /&gt;&lt;/br&gt;
  &lt;img id="output" /&gt;
  
  &lt;script&gt;
      onClick = function () {
          var source = document.getElementById("source");
          var canvas = document.createElement("canvas");
          canvas.width = source.width;
          canvas.height = source.width;
          var ctx = canvas.getContext("2d");
          ctx.drawImage(source, 0, 0);
          var output = document.getElementById("output");
          output.src = canvas.toDataURL("image/png");
      };
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I saw a lot of similar questions here but didn't find the answer. 
  Any help would be appreciated.</p>