avatars
Pixel avatar (npm-like) generator.
This module using strings as seed for generator. There are some examples:
Some random string (with 3 colors):
admin (with 2 colors):
username (with 2 colors and bigger cells):
Install
npm install --save avatars
Usage
Basic promise usage:
var avatars = ; ;
Basic callback usage:
var avatars = ;;
First argument of avatars() is parameters object for image generation. Avatars return image object that is created by Jimp module.
Parameters
Parameter | Description |
---|---|
seed | Some string that will be used as a seed for randomizer (default: random string) |
width | Width of the output image in px (default: 256) |
height | Height of the output image in px (default: 256) |
pwidth | Width of the generated pattern in cells (default: 16) |
pheight | Height of the generated pattern in cells (default: 16) |
filename | Filename to write the image (default: null) |
Example
var avatars = ; var params = seed: 'Some Random Name' // can be username, login, id etc width: 500 height: 500 pwidth: 15 pheight: 15 filename: './test.png' // file with this name will be created; ;