Skip to content

Quilljou/Tavatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tavatar

Tavatar, A simple script for generating avatar by given text!

See: demo

Installtion

Before use the script, you must install cario on your machine. because the package the script used depend on cario; detail see node-canvas

or you can just run the command compatible with your machine os。

os command
os x brew install pkg-config cairo pango libpng jpeg giflib
ubuntu sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
fedora sudo yum install cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel giflib-devel
solaris pkgin install cairo pango pkg-config xproto renderproto kbproto xextproto
windows instructions on our wiki

more os see node-canvas Wiki.

  • If you want this script works fine with chinese or janpanese text, your should Install the font WenQuanYi Micro Hei on your machine, Otherwise the image will be messy.
apt-get install fonts-wqy-microhei

detail see Automattic/node-canvas#461;

Finally.

$ npm i navatar -S

Usage

const Navatar = require('navatar');

// new an object
let avatar = new Navatar('name',100);

// write to disk
avatar.write('avatar.png');

// pipe as a Readable stream
avatar.stream().pipe(res)

// to buffer
avatar.toBuffer().toString('base64')

About

Tavatar, A simple script for generating avatar by given text!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published