How to Extract Details from an Image in JavaScript

Cloudmersive
1 min readMay 21, 2021

--

In this tutorial, we will cover how you can enable your application or website to automatically extract a wide range of information from any input image files. Utilizing the following API in JavaScript, you will be able to retrieve details such as size, MIME type, compression, EXIF data, and more.

Let’s begin by installing the jQuery library:

bower install jquery

Then, we can input the target image file into the following code:

var form = new FormData();
form.append("inputFile", fileInput.files[0], "file");
var settings = {
"url": "https://api.cloudmersive.com/convert/image/get-info",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "multipart/form-data",
"Apikey": "YOUR-API-KEY-HERE"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});

This operation provides support for over 100 different formats, which will ensure that very few (if any) image uploads fall out of scope.

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.