Generator of avatar
In Central Maven :
<dependency>
<groupId>com.talanlabs</groupId>
<artifactId>avatar-generator</artifactId>
<version>1.1.0</version>
</dependency>
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 |
Example 1 :
Avatar avatar = TriangleAvatar.newAvatarBuilder().build();
avatar.create(123456L);
Source : https://github.com/flouthoc/minBlock.js
Example 1 :
Avatar avatar = SquareAvatar.newAvatarBuilder().build();
avatar.create(123456L);
Source : https://github.com/donpark/identicon
Example 1 :
Avatar avatar = IdenticonAvatar.newAvatarBuilder().build();
avatar.create(123456L);
Example 1 :
Avatar avatar = GitHubAvatar.newAvatarBuilder().layers(new ColorPaintBackgroundLayer(Color.WHITE)).build();
avatar.create(123456L);
Example 2 :
Avatar avatar = GitHubAvatar.newAvatarBuilder().build();
avatar.create(123456L);
<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);
Example 2 :
Avatar avatar = CatAvatar.newAvatarBuilder()
.layers(new ShadowLayer(), new RandomColorPaintBackgroundLayer(), new RoundRectMaskLayer())
.padding(8).margin(8).build();
avatar.create(123456L);
<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);
Example 2 :
Avatar avatar = SmileyAvatar.newEyeMouthAvatarBuilder().build();
avatar.create(123456L);
Example 3 :
Avatar avatar = SmileyAvatar.newGhostAvatarBuilder().build();
avatar.create(123456L);
Example 4 :
Avatar avatar = SmileyAvatar.newDefaultAvatarBuilder().build();
avatar.create(123456L);
<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);
Example 2 :
Avatar avatar = EightBitAvatar.newFemaleAvatarBuilder().build();
avatar.create(123456L);