text2image
Installation:
npm i text2image
Usage:
const text2image = require('text2image')
Load font
const font = text2image.loadFont('path/to/font.ttf')
Converting text to image
// PNG
text2image.convert(font, 'Hello, World!', 0, 0, 72).then(buffer => {
fs.writeFileSync('hello_world.png', buffer) // <Buffer 89 50 4e ...
})
// SVG
text2image.convert(font, 'Hello, World!', 0, 0, 72, { useSvg: true }).then(buffer => {
fs.writeFileSync('hello_world.svg', buffer) // <Buffer 3c 73 76 ...
})