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 developer 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 size 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.

Previous Next

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 get size of the image without downloading it. In order to get size of the image, the API provides probe() method. The method gets source image and options for image processing. By using the following code, you can easily get size of your image without downloading it

Get Size of Image without Downloading

  1. Import Library
  2. 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');