title: Creating and saving to file new png image in JavaScript
body: <p>I am trying to create new empty image with width and height and save it as png to file.</p>
  
  <p>This is what i got:</p>
  
  <pre><code>var myImage = new Image(200, 200);
  myImage.src = 'picture.png';
  
  
  window.URL = window.webkitURL || window.URL;
  
  var contentType = 'image/png';
  
  var pngFile = new Blob([myImage], {type: contentType});
  
  var a = document.createElement('a');
  a.download = 'my.png';
  a.href = window.URL.createObjectURL(pngFile);
  a.textContent = 'Download PNG';
  
  a.dataset.downloadurl = [contentType, a.download, a.href].join(':');
  
  document.body.appendChild(a);
  </code></pre>
  
  <p>I am trying to get transparent image with given width and height in <code>var myImage  new Image(200, 200)</code> as the output on the download.</p>