I'm having difficulty using imagemagick in node. It keeps erroring with the following message:
/usr/src/love/mean/node_modules/imagemagick/imagemagick.js:156
geometry = result['geometry'].split(/x/);
^
TypeError: Cannot call method 'split' of undefined
at null.callback (/usr/src/love/mean/node_modules/imagemagick/imagemagick.js:156:39)
at Accumulator.finish (/usr/src/love/mean/node_modules/imagemagick/imagemagick.js:60:55)
at ChildProcess.<anonymous> (/usr/src/love/mean/node_modules/imagemagick/imagemagick.js:86:11)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
The code is pretty simple:
var im = require('imagemagick');
im.identify('li14_beach.jpg', function(err, features){
if (err) throw err;
console.log(features);
// { format: 'JPEG', width: 3904, height: 2622, depth: 8 }
});
The image li14_beach.jpg
is in the same directory as the node executable.
I have ImageMagick 6.5.4-7 2014-02-10 running on CentOS 6. The commands Convert
and Identify
are available through the command line. The weird thing is, the above works fine on Ubuntu.
Thanks