Get the width and height of any image on the Internet. Supports BMP, GIF, JPEG, PNG, PSD.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore all the things Feb 19, 2014
README.md
index.js
package.json

README.md

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