Using mulcher in the buffer with GraphicsMagick


I'm trying to resize an image uploaded in memory, using multer over express to get the file. While I can access req.files.picture.buffer and it shows some content, when I pass the buffer to GM I receive a ENOENT. The code is as follows:

var buffer = req.files.picture.buffer

  .options({imageMagick: true})
  .toBuffer('PNG', function (err, buffer) {
    if (err) return handle(err);

return res.sendStatus(200);

Either using toBuffer or write as the output I get the same ENOENT. Am I missing something?

According to the gm Buffer example, you also need to supply a filename for the data. Example: gm(buffer, 'foo.jpg')