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?
There was some problem with my Linux setup and ImageMagick was not available to Node.js. After re-configuring the machine the code works without changes.