react-native-buffer-image-size
A Node module to get dimensions of any image file buffer
Fork of buffer-image-size
This fork ensures compatibility with Browsers & React Native.
Supported formats
- BMP
- CUR
- GIF
- ICO
- JPEG
- PNG
- PSD
TIFF(no buffer support)- WebP
- SVG
- DDS
Install
npm install react-native-buffer-image-size --save
Usage
var sizeOf = ;var dimensions = ;console;
Multi-size
If the target file is an icon (.ico) or a cursor (.cur), an images
array is available and returns the dimensions of all the available images.
var sizeOf = ;var images = images;for const dimensions of images console;
URL
var url = ;var http = ; var sizeOf = ; var imageUrl = '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.