I want to manipulate an image with pure NodeJS
I can't find a way how to get the pixel data of an image. I can get the buffer and base64 of the image. I found many libraries that provide this functionality, but I can't reproduce it myself. I thought this was easy to do because in JavaScript we have a Canvas which gives any information about an image and is easy to manipulate
Here is my code:
var fs = require('fs');
fs.readFile('cat.png', (e,image) => {
console.log(image.toString('base64'));
})
May be here is another way how to read the image?
If this is not possible with pure Node JS, could you please explain to me:
- Why?
- How do other libraries work with images?