title: PNG from Post Request loading into Canvas
body: <p>This is a very specific problem, and I am yet to find anyone else asking it.</p>
  
  <p>Basically I have a servlet that accepts some parameters and returns a PNG image. I know the servlet works because if I open the page itself with the given parameters, the file is created and downloaded successfully. I need some way of taking this generated PNG and load it into an HTML5 Canvas. </p>
  
  <p>I do NOT have access to changing the servlet and it has to be a POST request as it was not designed by me. My code is essentially just a jQuery post request at this point but here it is:</p>
  
  <pre><code>$.post("../dgexport?format=png",
  {
      data: localStorage.getItem("dg::export"),
      responseType: "blob",
  },
  function(res){
      loadCanvas(res);
  });
  
  function loadCanvas(image) {
      var canvas = document.getElementById('myCanvas');
      var context = canvas.getContext('2d');
  
      // load image
      context.drawImage(image, 0, 0); 
  }
  </code></pre>
  
  <p>When I open up the console and look at the data response of the POST request it looks like in the console:</p>
  
  <pre><code>�PNG↵↵IHDR��lD�V    pHYs�� IDATx��~---���088'���� IDAT��?��q%�
  </code></pre>
  
  <p>(this is not the whole thing but I'm hoping it's enough to give a hint to anyone willing to help)</p>
  
  <p>Any help would be greatly appreciated! I've tried a lot of different methods and I'm really stumped on this one.</p>