Sharp works very well and is easy to use with streams, it works like a charm, but you need to compile it with the version of the node, this is its drawback. I used Sharp to process images with an image from the AWS S3 recycle bin and worked fine, but I had to use a different module. GM didn't work for me, but Jimp worked really well!
You should pay attention to the path of the written picture, this can lead to errors if you start the path with "/".
This is how I used Jimp in nodeJS:
const imageUrl = 'SOME_URL'; let imgExported = 'EXPORTED_PIC.png'; Jimp.read(imageUrl) .then(image => { image .resize(X, Y) .write('tmp/'+ imgExported, err => { if(err) console.error('Write error: ', err); else { ...
Also keep track of the execution order, set a callback so that other things don't happen when you don't want to. I tried using "await" for Jimp.read (), but that did not help.
Alex Seceleanu May 15 '19 at 9:17 a.m. 2019-05-15 09:17
source share