title: Error: write EPIPE with node.js and imagemagick
body: <p>I'm lost as to where this error is coming from, and I'm hoping you can help me. I'm new to node and am trying to resize an image with imagemagick:</p>
  
  <pre><code>var express = require('express'), 
  fs = require('fs'),
  gm = require('gm'),
  imagemagick = require('imagemagick'),
  var gm = require('gm').subClass({ imageMagick: true });
  var app = express();
  
  
  app.get('/', function (req, res) {
      console.log(__dirname + "/public/photos/4af1e720-a662-11e3-952c-61812ab60f67.jpg");
      imagemagick.resize({
             srcData: fs.readFileSync(__dirname + "/public/photos/4af1e720-a662-11e3-952c-61812ab60f67.jpg", 'binary'),
             width: "400"
      }, function(err,stdout,stderr){
             if (err) console.log(err);
             fs.writeFile(__dirname + "/public/photos/thumbnail/4af1e720-a662-11e3-952c-61812ab60f67.jpg", stdout, 'binary');
      });
  });
  </code></pre>
  
  <p>I get the following:</p>
  
  <p>I've already checked that the folder thumbnail/ exists, and that the image exists. Do you know what else could be going on? </p>
  
  <pre><code>/Users/ik/Dropbox/snapgram/public/photos/4af1e720-a662-11e3-952c-61812ab60f67.jpg
  
  events.js:72
      throw er; // Unhandled 'error' event
            ^
  Error: write EPIPE
      at errnoException (net.js:904:11)
      at Object.afterWrite (net.js:720:19)
  computername:snapgram ik$ 
  </code></pre>