Skip to content

Latest commit

 

History

History
30 lines (26 loc) · 816 Bytes

README.md

File metadata and controls

30 lines (26 loc) · 816 Bytes

text2image

Hits

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 ...
})