Node.js Project to Convert Animated GIF to Animated PNG (APNG) Format Using gif-to-apng Library Full Project For Beginners

Node.js Project to Convert Animated GIF to Animated PNG (APNG) Format Using gif-to-apng Library Full Project For Beginners

 

Welcome folks today in this blog post we will be converting gif to animated png apng format using gif-to-apng library. All the source code of the application is given below.

 

 

 

Get Started

 

 

 

In order to get started we need to install gif-to-apng library by using the npm command

 

npm i gif-to-apng

 

After installing this dependency inside this project you just need to make a index.js file inside your node.js project and copy paste the following code

 

index.js

 

 

const toApng = require('gif-to-apng')
 
toApng('image.gif')
  .then(() => console.log('Done 🎉'))
  .catch(error => console.log('Something went wrong 💀', error))

 

 

You can see in the above portion of code we have included the dependency gif-to-apng library and then we are using this method to convert the input gif image which is provided as the first argument and then we have a callback function once the conversion has completed and also we have an error callback if any sort of error takes place.

See also  Javascript Project to Convert Indian Number Currency to Lakhs & Crores Words System in Browser Using HTML5 Full Project For Beginners

 

Now if you execute this application by running the node.js app by running the following command

 

node index.js

 

 

 

 

 

And now you can see that an output image.png file is created and we have successfully converted the gif image to animated png apng image.

 

Leave a Reply