So I have a sample.jpg file, And I want to check its dimensions..
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 wnat 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?
from How to check an image dimensions using js or node
No comments:
Post a Comment