image-size
A Node module to get dimensions of any image file
Supported formats
- BMP
- GIF
- JPEG
- PNG
- PSD
- TIFF
- WebP
- SVG
Upcoming
- SWF
Programmatic Usage
npm install image-size --save
Synchronous
var sizeOf = ;var dimensions = ;console;
Asynchronous
var sizeOf = ;;
NOTE: The asynchronous version doesn't work if the input is a Buffer. Use synchronous version instead.
Using a URL
var url = ;var http = ; var sizeOf = ; var imgUrl = 'http://my-amazing-website.com/image.jpeg';var options = url; http;
You can optionally check the buffer lengths & stop downloading the image after a few kilobytes. You don't need to download the entire image
Command-Line Usage (CLI)
npm install image-size --global
image-size image1 [image2] [image3] ...
Credits
not a direct port, but an attempt to have something like dabble's imagesize as a node module.