Answer the question
In order to leave comments, you need to log in
How to paste text on an image with a background in the middle and multiline?
I just need to sculpt text on images where there should be a black background. I decided to paste the text on the newly created object, get the size of the output result in pixels, add a background and merge it with the image itself. This is how shit turned out in the end:
gm(400, 100, 'black')
.font("Helvetica.ttf", 50)
.fill('#333')
.drawText(0, 0, 'hello world how are you me interesting ???', 'Center')
.write('new.jpg', (err) => {
if (err) console.log(err);
gm('new.jpg').size(function(err, size) {
console.log('size: ', size);
// .drawRectangle(coords, size)
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question