Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

text2png

1.1.1 • Public • Published

NPM npm version

text2png: text-to-png generator for Node.js

text2png('Create png image\nfrom multi-line text!');

text2png

Quick start

$ npm install text2png
var fs = require('fs');
var text2png = require('text2png');
fs.writeFileSync('out.png', text2png('Hello!', {textColor: 'blue'}));

text2png depends on node-canvas.

See node-canvas wiki on installing node-canvas.

Option

text2png(text, option)

param default
text (required)
option.font '30px sans-serif'
option.textColor 'black'
option.bgColor null
option.lineSpacing 0
option.padding 0
option.output 'buffer'

option.output = 'buffer' | 'stream' | 'dataURL' | 'canvas'

'canvas' returns node-canvas object.

Example

text2png('Example\nText', {
  font: '80px Futura',
  textColor: 'teal',
  bgColor: 'linen',
  lineSpacing: 10,
  padding: 20
});

ExampleText

Enjoy!

Keywords

install

npm i text2png

Downloadsweekly downloads

738

version

1.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability