I'm trying to burn an image to disk and after that generate a thumb of the image that was saved.
To do this I save the normal base64 image that was sent and in the callback of fs.writeFile I call the function to generate the thumb.
I'm trying to generate the thumb using the imagemagick package
const im = require('imagemagick');
const fs = require('fs');
const imagemCapa = objetoFolder + "\" + comando.imagemCapa;
const imagemCapaThumb = objetoFolder + "\capa_thumb.jpg";
//Grava no disco
fs.writeFile(imagemCapa, comando.imagemCapaBase64, 'base64', (err) => {
if(err) console.log(err);
//Thumb
const optionsThumb = {
srcPath: imagemCapa,
dstPath: imagemCapaThumb,
width: 262
};
im.resize(optionsThumb, (err, stdout, stderr) => {
if (err) console.log(err);
console.log('Thumb gerado');
});
});
I can burn the image to disk but it is not generating the thumb.
Who can help thank you in advance! A hug.