Convert a GIF to PNG in JavaScript

When performing image format conversions, you don’t want to burn your valuable production time writing the complex code needed for the process. For example. If you have a GIF you need to transformed into a PNG, instead of building the operation out manually, we will demonstrate how you can use an API to automatically run the conversion in seconds.

We will begin the operation by installing the jQuery library:

bower install jquery

Then, we can call the conversion function with the following code:

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

The output will be your new PNG file! If you need to retrieve your API key, head over to the Cloudmersive website to register for a free account; this will give you access to 800 monthly calls across our library of APIs.

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