fetch-image-size
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

fetch-image-size

Detects image dimensions without downloading the entire image. Requests are aborted as soon as image-size is able to obtain the image size.

Supports all the image formats supported by image-size:

  • BMP
  • CUR
  • DDS
  • GIF
  • HEIC (HEIF, AVCI, AVIF)
  • ICNS
  • ICO
  • J2C
  • JP2
  • JPEG
  • KTX (1 and 2)
  • PNG
  • PNM (PAM, PBM, PFM, PGM, PPM)
  • PSD
  • SVG
  • TGA
  • TIFF
  • WebP

Basic usage

import { fetchImageSize } from 'fetch-image-size'

const size = await fetchImageSize('http://nodejs.org/images/logo.png')

Result:

{ width: 245, height: 66, type: 'png', downloaded: 856 }

Prior Art

Package Sidebar

Install

npm i fetch-image-size

Weekly Downloads

2

Version

3.0.1

License

MIT

Unpacked Size

10.3 kB

Total Files

6

Last publish

Collaborators

  • aleclarson