avatar-generator
8bit avatar generator like one below.
Inspired by https://github.com/matveyco/8biticon (icons also theirs).
Generate same icons for same ids like gravatar,
Use email or md5 or any string for generating and get the same avatar.
Getting Started
Install the module with: npm install avatar-generator
This library uses http://sharp.pixelplumbing.com/ for all image processing.
Version 2.0 is not compatible with 1.x
const AvatarGenerator = require('avatar-generator')
const avatar = new AvatarGenerator({
parts: ['background', 'face', 'clothes', 'head', 'hair', 'eye', 'mouth'],
partsLocation: path.join(__dirname, '../img'),
imageExtension: '.png'
})
const variant = 'female'
const image = await avatar.generate('email@example.com', variant)
image
.png()
.toFile('output.png')
image
.png()
.pipe(someWriteableStream)
image
.resize(300,300)
.png()
.toFile('output300x300.png')
image
.webp()
.toFile('output.webp')
Install with cli command
$ npm install -g avatar-generator
$ avatar-generator --help
$ avatar-generator --version
License
Copyright (c) 2019 arusanov
Licensed under the MIT license.