Skip to content

aleclarson/fetch-image-size

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Detect image dimensions via fetch.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%