Mamsaac Mamsaac - 1 year ago 66
Javascript Question

Opening images on NodeJS and finding out width/height

Thanks a lot in advance for the future help. What I need is the equivalent of a "new Image()" (and then myImage.src... etc) but on NodeJS. I will thank whoever answers quickly deep in my heart... and well, also saying "thanks!" :P

Answer Source

There's node-imagemagick, (you'll need to have ImageMagick, obviously).

var im = require('imagemagick');
im.identify('kittens.jpg', function(err, features){
  if (err) throw err
  // { format: 'JPEG', width: 3904, height: 2622, depth: 8 }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download