Sotiris Kaniras
Sotiris Kaniras

Reputation: 680

NodeJS - How to get image dimensions?

I'm on a NodeJS server running parse server and I send from my iOS app, the UIImageJPEGRepresentation of an image, to a cloud function call. What I want, is to retrieve the image dimensions, from my cloud function...

I've searched and searched, but without any luck!

Any ideas?

Upvotes: 1

Views: 7090

Answers (1)

sarkiroka
sarkiroka

Reputation: 1542

Look at this: https://www.npmjs.com/package/image-size This lib can calculate the image dimensions:

var sizeOf = require('image-size');
sizeOf('images/funny-cats.png', function (err, dimensions) {
  console.log(dimensions.width, dimensions.height);
});

Upvotes: 1

Related Questions