Welcome folks today in this blog post we will be converting
animated png apng format using gif-to-apng library. All the source code of the application is given below.
In order to get started we need to install
gif-to-apng library by using the
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
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.
Now if you execute this application by running the
node.js app by running the following command
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.