dimensions

0.1.0 • Public • Published

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')
 
dimensions('http://upload.wikimedia.org/wikipedia/en/7/70/Example.png', function(err, dimensions){
  if (err) throw err
  console.log(dimensions)
})

The above yields:

{
  height: 297,
  width: 275
}

See tests/index.js for more usage examples.

License

WTFPL

Package Sidebar

Install

npm i dimensions

Weekly Downloads

34

Version

0.1.0

License

WTFPL

Last publish

Collaborators

  • zeke