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)
})