So I have a sample.jpg
file and I want to check its dimensions.
The desired logic goes like this:
var img = require('./sample.jpg');
console.log(typeof img) // returns string -> Image
console.log(img.height) // returns number -> 300
console.log(img.width) // returns nubmer -> 250
Never mind the return of the typeof
. I just wan't to get the dimensions. But that is the simple break down of what where I am going. Is there a way to do this using node or plain js?