dimensions

Get the width and height of any image on the Internet. Supports BMP, GIF, JPEG, PNG, PSD.

Downloads
134
Stars
6
Committers
2

dimensions

Get the width and height of any image on the Internet. Supports BMP, GIF, JPEG, PNG, PSD.

Install it

npm install dimensions --save

Use it

Give dimensions an image URL, get back an object with the image's width and height in pixels.

var dimensions = require('dimensions')
var url = 'http://placekitten.com/g/200/300'

dimensions(url, function(err, dimensions){
  if (err) throw err
  console.log(dimensions)
})

The above yields:

{
  height: 300,
  width: 200
}

See test/index.js for more usage examples.

License

WTFPL