browser-image-size

Get image size in the browser

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
browser-image-size
1301.1.07 years ago7 years agoMinified + gzip package size for browser-image-size in KB

Readme

Browser image size
!NPM versionnpm-imagenpm-url !build statustravis-imagetravis-url
!Sauce Test Statussauce-imagesauce-url

Installation

$ npm install browser-image-size

To use browser-image-size you must polyfill Promise.

Usage

var browserImageSize = require('browser-image-size')

browserImageSize('128.png')
.then(function (size) {
  console.log(size)
  // => {height: 128, width: 128}
})

API

browserImageSize(image)

Parameters:
  • image : {(File|blob|string)} File, blob, or URL string

Returns:
  • BrowserImageSizePromise : {Promise} resolved with object containing image width and height

Tests

$ npm test -- --local

License

MIT