In NodeJS I need to create an API for remote image processing. Using the URL of an image I need to get all the relevant data (width, height, file size,etc) and then process it using a library like Graphics magick. The problem is, that gm always returns this error
{ [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
The code I used is
request.get(imageUrl, function (err, res, body) {
var buffer = new Buffer(body,'binary');
gm(buffer)
.size(function (err, size) {
if (!err) {
console.log('width = ' + size.width);
console.log('height = ' + size.height);
} else
console.log(err)
});
});
The question is: How can i process an image without downloading it?