title: Graphicsmagick for node not writing the jpg
body: <p>I am using <a href="https://github.com/aheckmann/gm" rel="nofollow">https://github.com/aheckmann/gm</a> to resize an image.</p>
  
  <pre><code>    var gm = require('gm').subClass({ imageMagick: true });
      var fs = require('fs');
  
      var dir = __dirname+'/img';
  
      var readStream = fs.createReadStream(dir + '/Desert.jpg');
      var writeStream = fs.createWriteStream(dir + '/resize.jpg');
  
       gm(readStream)
          .size({bufferStream: true}, function(err, size) {
              this.resize(50, 50, '%')        
              this.write(writeStream, function (err) {
              if (!err) console.log('done');
          });
       });
  </code></pre>
  
  <p>I am using the above code to resize an image....the problem is an empty image is getting generated and the error message is {[Error: write EPIPE] code:'EPIPE',errno: 'EPIPE', syscall:'write'}</p>