Opening images on NodeJS and finding out width/height

Using imagemagick for this is very overkill since you only want to read the header of the file and check the dimensions. image-size is a pure javascript implementation of said feature which is very easy to use.

https://github.com/image-size/image-size

var sizeOf = require('image-size')

sizeOf('images/funny-cats.png', function (err, dimensions) {
  if (err) throw err

  console.log(dimensions.width, dimensions.height)
})

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
  console.log(features)
  // { format: 'JPEG', width: 3904, height: 2622, depth: 8 }
})