I need to add a text on a image using Jimp node module. But sometimes it get confused with the image. For example: Black text hover an image with black on itself.
So i need to insert a white square and write with black inside of it.
Didnt find it on the documentation of Jimp.
My actual code:
await Jimp2.read(nomeArquivo)
.then(function (image) {
loadedImage = image;
return Jimp2.loadFont(Jimp2.FONT_SANS_16_BLACK);
})
.then(function (font) {
loadedImage.print(font, 45, 45,'car' ,450 , (err, image, { x, y }) => {
image.print(font, 45, y + 4, {
text: 'this car is ok',
alignmentX: Jimp2.HORIZONTAL_ALIGN_CENTER,
alignmentY: Jimp2.VERTICAL_ALIGN_MIDDLE
},450);
} )
.write(nomeArquivo);
})
.catch(function (err) {
console.error(err);
});
This writes the text hover the image, but not the square.
Thanks!