text2image
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

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

Package Sidebar

Install

npm i text2image

Weekly Downloads

5

Version

1.2.1

License

GPL-3.0

Unpacked Size

358 kB

Total Files

7

Last publish

Collaborators

  • nurutomo