# image-file-size

> get dimensions of any image file in browser

Latest version **1.0.1** (published 2018-05-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install image-file-size
pnpm add image-file-size
yarn add image-file-size
bun add image-file-size
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-05-06 |
| First published | 2018-05-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 163.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alan Lu |
| Maintainers | luxp |
| Keywords | image, file, size |

## Links

- npm: https://www.npmjs.com/package/image-file-size
- Repository: https://github.com/luxp/image-file-size
- Homepage: https://github.com/luxp/image-file-size#readme
- Issues: https://github.com/luxp/image-file-size/issues
- npm.io page: https://npm.io/package/image-file-size

## Dependencies (1)

- [exif-js](https://npm.io/package/exif-js.md) ^2.3.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-05-06
- 1.0.0 — 2018-05-06
- 0.0.3 — 2018-05-06
- 0.0.2 — 2018-05-06

## README

# image-file-size

A module for browser to get dimensions of any image file, autodetect the orientation of the image file

[online demo](https://luxp.github.io/image-file-size/demo/dist/)

## Usage
- npm install --save image-file-size

```js
import {getImageSize} from 'image-file-size'

document.getElementById('fileInput').onchange = function (event) {
  let file = event.target.files[0]
  if (file) {
    getImageSize(file)
      .then((result) => {
        document.getElementById('result').innerText = JSON.stringify(result, null, 2)
      })
  }
}
```

the `getImageSize` will return an object like `{width: 100, height: 300}`

## LICENCE
[MIT](https://opensource.org/licenses/MIT)

Copyright (c) 2018-present, Xianpo (Alan) Lu

---
_Source: https://npm.io/package/image-file-size · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
