164
rated 0 times
[
167]
[
3]
/ answers: 1 / hits: 20211
/ 7 Years ago, thu, october 12, 2017, 12:00:00
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?
More From » node.js