Code Monkey home page Code Monkey logo

avatar-generator's Introduction

avatar-generator Build Status

8bit avatar generator like one below.

Like this one

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.

Demo

http://eightbitavatar.herokuapp.com/?id=userid&s=male&size=400

Where: id - your user id s - sex (male|female) size - avatar size

Deploy

Getting Started

Install the module with: npm install avatar-generator

var avatar = require('./lib/avatar-generator')({
    //Optional settings. Default settings in 'settings.js'
    order:'background face clothes head hair eye mouth'.split(' '), //order in which sprites should be combined
    images:require('path').join(__dirname,'./img'), // path to sprites
    convert:'convert' //Path to imagemagick convert
});
avatar('User ID (email or hash or any string)', 'male|female', 400)
    .stream()
    .pipe(stream);

Image file

avatar('User ID', 'male|female', imageWidth)
    .write(filename, function (err) {});

Image buffer

avatar('User ID', 'male|female', imageWidth)
    .toBuffer(function (err,buffer){
    //Do something with buffer. eg buffer.toString('base64');
    });

Image stream

avatar('User ID', 'male|female', imageWidth)
    .stream()
    .pipe(anotherStream);

Install with cli command

$ npm install -g avatar-generator
$ avatar-generator --help
$ avatar-generator --version

Examples

See example/*.js

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

License

Copyright (c) 2014 Alex R
Licensed under the MIT license.

avatar-generator's People

Contributors

arusanov avatar jca02266 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.