0

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

Dharmesh Kheni
  • 71,228
  • 33
  • 160
  • 165
user3508995
  • 187
  • 1
  • 1
  • 13

1 Answers1

1

I solved this issue manually. Just edited imagemagick.js file and put there few if expressions, like

if(result['geometry']) ...

end other needed

dmitriy.g
  • 101
  • 1
  • 5