I have the code in Javascript that I paste below, the result obtained with method 1 is correct, that is, an image in base64 format when the conversion starts from reading a file. But when I use the value returned by Jimp the conversion is done to "image/octet-stream" format, any suggestions?
var bitMap = new Jimp({ data: Buffer.from(gray.data), width: this.PicMatrixX, height: this.PicMatrixY, mime: Jimp.MIME_JPEG }, (err, image,) => {
image.write(this.PatNo + "_" + this.PatMeasNo + '.jpg')
})
this.base64 = fs.readFileSync(this.PatNo + "_" + this.PatMeasNo + '.jpg', "base64"); // Method 1
this.imagen = new Buffer.from(bitMap.bitmap.data).toString("base64") //Method 2