简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM