How to use "Jimp" to convert ImageData into .png and then write in the file in JavaScript?

44 Views Asked by At

I am preprocessing the image and getting an ImagaData. Now, I want to convert that ImageData into .png, get the buffer and write it into a file. How can I do it?

Jimp.read(imageData)
  .then((imageData) => {
       let file = "output.png"
       return image.write(file)
  })
  .catch((err) => {
    // Handle an exception.
  });

After that I wanted to read the image from the file and use it. If possible, convert it into b64.

0

There are 0 best solutions below