bostrom/text-to-image

Text rotation

Opened this issue · 2 comments

Hello Everyone,

Is there a solution for rotating the text?

Thanks

Hello @ahmedalnaqaa. There's no built in solution for text rotation at the moment, and I myself don't have much time to look into it, but I'm happy to accept PRs 🙂

I try to rotate with jimp and it does work with just a few steps. However, it rotates the whole image instead of text.

const textToImage = require('text-to-image');
const Jimp = require('jimp');

async function rotateImage(img,name) {
    const image        = await Jimp.read(img);
    const rotate_angle = 10;
    image.rotate(rotate_angle).write('hello/'+name+'.png');
}
  
textToImage.generate('Hello world').then(datauri=>{
    let buff    = datauri.substring(22);
    const image = Buffer.from(buff,'base64');
    rotateImage(image,"filename");
})