How to Resize an Image with JavaScript

Looking for a way to manipulate photos automatically? Thankfully, there’s a Cloudmersive API for that. Our Image Resizing API is exif-aware and provides customizable width & height parameters for the output image. To structure your API call in JavaScript, take advantage of the code provide below in this article, or visit our API page for code examples in a dozen other common programming languages.

Let’s first begin installation of the jQuery library by running the below command:

bower install jquery

Next, let’s include a snippet to capture the input image file(s):

var form = new FormData();
form.append("imageFile", fileInput.files[0], "file");

Finally, call the API:

var settings = {
"url": "<integer>/<integer>",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "multipart/form-data",
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
$.ajax(settings).done(function (response) {

All done. To get a Cloudmersive API key, head to our website and register for a free account.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


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