title: How to resize base64 image using gm
body: <p>I can't seem to make it work to resize. How can I resize base64 image using gm?</p>
  
  <p>I have the following code:</p>
  
  <pre><code> var regexBase64ContentType     = /^data:image\/\w+;base64,/;
   var buffer = new Buffer(imgData.replace(regexBase64ContentType, ""),'base64');
  
      gm(buffer, "img.png")
          .resize(height, width)
          .toBuffer('PNG', function(err, buf){
              return buf;
          });
  </code></pre>