Open Source JavaScript Library for Image Processing
Get image size without full download.
What is Probe-Image-Size?
Probe-Image-Size is a free and open-source API that allows JavaScript developers to get the image size of the image without actually downloading the image. The API is small in size and works with remote and local data without any heavy dependencies. The API is effective with large images, reduces memory, increases processing speed, and downloads minimal data from the remote. In the output data, the API provides the width and height of the image before any transformations like orientation and cropping are applied.
The API currently supports getting file sizes of JPEG, GIF, PNG, WebP, BMP, TIFF, SVG, PSD, ICO, AVIF, HEIC, and HEIF. Formats like JPEG & TIFF can store size anywhere. Always provide full file content to sync methods, if you want to guarantee the file size.
Getting Started with Probe-Image-Size
The recommended way to install Probe-Image-Size via NPM. Please use the following command to install it.
Install Probe-Image-Size via NPM
npm install probe-image-size
Get Image Size via Free JavaScript API
The open source Probe-Image-Size library allows JavaScript developers to get the size of the image without downloading it. In order to get the size of the image, the API provides probe() method. The method gets the source image and options for image processing. By using the following code, you can easily get the size of your image without downloading it
Get Size of Image without Downloading
- Import Library
- Get Image Size
Get Image Size in JavaScript
const probe = require('probe-image-size');
// get by URL
let result = await probe('http://example.com/image.jpg');