Giter VIP home page Giter VIP logo

avatar-generator's Introduction

Avatar Generator

Generator of avatar

image

Dependency

In Central Maven :

<dependency>
    <groupId>com.talanlabs</groupId>
    <artifactId>avatar-generator</artifactId>
    <version>1.1.0</version>
</dependency>

Usage

Use Avatar avatar = Avatar.newBuilder()...build()

Configuration :

Method Description
elementRegistry(ElementRegistry elementRegistry) Registry elements & groups
size(int width, int height) Size of final image
padding(int padding) Add padding in pixel of elements
margin(int margin) Add marge in pixel
layers(ILayer... layers) Add layers to apply in elements
color(Color color) Colorize all elements
colorizeFunction(IColorizeFunction colorizeFunction) Colorize elements
cache(ICache cache) Use cache

Create :

Use avatar.create...

Method Description
BufferedImage create(long code) Create Avatar as BufferedImage
byte[] createAsPngBytes(long code) Create Avatar as Png byte array
void createAsPngToFile(long code, File file) Create Avatar as Png to file

Predefined avatar

Triangle

Example 1 :

Avatar avatar = TriangleAvatar.newAvatarBuilder().build();

avatar.create(123456L);

Sample Triangle1

image

Square

Source : https://github.com/flouthoc/minBlock.js

Example 1 :

Avatar avatar = SquareAvatar.newAvatarBuilder().build();

avatar.create(123456L);

Sample Square1

image

Identicon

Source : https://github.com/donpark/identicon

Example 1 :

Avatar avatar = IdenticonAvatar.newAvatarBuilder().build();

avatar.create(123456L);

Sample Identicon1

image

GitHub

Example 1 :

Avatar avatar = GitHubAvatar.newAvatarBuilder().layers(new ColorPaintBackgroundLayer(Color.WHITE)).build();

avatar.create(123456L);

Sample GitHub1

image

Example 2 :

Avatar avatar = GitHubAvatar.newAvatarBuilder().build();

avatar.create(123456L);

Sample GitHub2

image

Cat

<dependency>
    <groupId>com.talanlabs</groupId>
    <artifactId>avatar-generator-cat</artifactId>
    <version>1.1.0</version>
</dependency>

Images sources : CC-By 4.0 attribution: David Revoy https://framagit.org/Deevad/cat-avatar-generator

Example 1 :

Avatar avatar = CatAvatar.newAvatarBuilder().build();

avatar.create(123456L);

Sample Cat1

image

Example 2 :

Avatar avatar = CatAvatar.newAvatarBuilder()
    .layers(new ShadowLayer(), new RandomColorPaintBackgroundLayer(), new RoundRectMaskLayer())
    .padding(8).margin(8).build();

avatar.create(123456L);

Sample Cat2

image

Smiley

<dependency>
    <groupId>com.talanlabs</groupId>
    <artifactId>avatar-generator-smiley</artifactId>
    <version>1.1.0</version>
</dependency>

Example 1 :

Avatar avatar = SmileyAvatar.newAccessoriesAvatarBuilder().build();

avatar.create(123456L);

Sample Smiley1

image

Example 2 :

Avatar avatar = SmileyAvatar.newEyeMouthAvatarBuilder().build();

avatar.create(123456L);

Sample Smiley2

image

Example 3 :

Avatar avatar = SmileyAvatar.newGhostAvatarBuilder().build();

avatar.create(123456L);

Sample Smiley3

image

Example 4 :

Avatar avatar = SmileyAvatar.newDefaultAvatarBuilder().build();

avatar.create(123456L);

Sample Smiley4

image

8 bit

<dependency>
    <groupId>com.talanlabs</groupId>
    <artifactId>avatar-generator-8bit</artifactId>
    <version>1.1.0</version>
</dependency>

Images sources : https://github.com/o1egl/govatar

Example 1 :

Avatar avatar = EightBitAvatar.newMaleAvatarBuilder().build();

avatar.create(123456L);

Sample 8bit1

image

Example 2 :

Avatar avatar = EightBitAvatar.newFemaleAvatarBuilder().build();

avatar.create(123456L);

Sample 8bit2

image

avatar-generator's People

Contributors

plezy 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.