fetch-image-size
v3.0.1
Published
Detect image dimensions via fetch
Downloads
8
Maintainers
Readme
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 }