text-to-image icon indicating copy to clipboard operation
text-to-image copied to clipboard

Text rotation

Open ahmed-alnaqa opened this issue 5 years ago • 2 comments

Hello Everyone,

Is there a solution for rotating the text?

Thanks

ahmed-alnaqa avatar Aug 09 '20 11:08 ahmed-alnaqa

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 🙂

bostrom avatar Aug 10 '20 08:08 bostrom

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");
})

ronaldaug avatar Sep 16 '21 12:09 ronaldaug