Mamsaac Mamsaac - 4 months ago 7x
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


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 }