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
gm(buffer)
.options({imageMagick: true})
.resize(300)
.toBuffer('PNG', function (err, buffer) {
if (err) return handle(err);
console.log('done!');
});
return res.sendStatus(200);
Either using toBuffer or write as the output I get the same ENOENT. Am I missing something?
According to the
gmBuffer example, you also need to supply a filename for the data. Example:gm(buffer, 'foo.jpg')