All Projects → afkbrb → github-avatar-generator

afkbrb / github-avatar-generator

Licence: Apache-2.0 license
Generate github-style avatar with java awt

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to github-avatar-generator

avatar-gen
pillow 生成头像,中英文首字母或者随机像素化。Using pillow for generate avatars, first letter of string in Chinese and English or random pixel like avatars.
Stars: ✭ 31 (-16.22%)
Mutual labels:  avatar, avatar-generator
monsterid
Node.js porting of the original PHP library
Stars: ✭ 15 (-59.46%)
Mutual labels:  avatar, avatar-generator
identicon-api
A simple API to retrieve SVG identicons
Stars: ✭ 15 (-59.46%)
Mutual labels:  avatar, avatar-generator
monsterID
The original MonsterID implementation
Stars: ✭ 56 (+51.35%)
Mutual labels:  avatar, avatar-generator
AvatarGAN
Generate Cartoon Images using Generative Adversarial Network
Stars: ✭ 24 (-35.14%)
Mutual labels:  avatar, avatar-generator
monsterid
MonsterID adaptation for Composer and modern PHP versions
Stars: ✭ 20 (-45.95%)
Mutual labels:  avatar, avatar-generator
react-nice-avatar
react library for generating avatar
Stars: ✭ 700 (+1791.89%)
Mutual labels:  avatar, avatar-generator
minidenticons
Super lightweight SVG identicon (icon avatar) generator
Stars: ✭ 89 (+140.54%)
Mutual labels:  avatar, avatar-generator
pixitar
🧝 Pixitar is an avatar generation library written in Ruby.
Stars: ✭ 20 (-45.95%)
Mutual labels:  avatar, avatar-generator
boring-avatars
Boring avatars is a tiny JavaScript React library that generates custom, SVG-based avatars from any username and color palette.
Stars: ✭ 3,582 (+9581.08%)
Mutual labels:  avatar, avatar-generator
Avataaars Generator
Simple generator React app for avataaars
Stars: ✭ 2,078 (+5516.22%)
Mutual labels:  avatar, avatar-generator
avatarcropper
Simple quick avatar cropper!
Stars: ✭ 45 (+21.62%)
Mutual labels:  avatar, avatar-generator
ts3admin.class
The ts3admin.class is a powerful api for communication with Teamspeak 3 Servers from your website! Your creativity knows no bounds!
Stars: ✭ 107 (+189.19%)
Mutual labels:  avatar
react-bones
💀 Dead simple content loading components for React and React-Native. 💀
Stars: ✭ 42 (+13.51%)
Mutual labels:  avatar
avatar
Simple online tool for cropping images from an URL, your clipboard, or your disk.
Stars: ✭ 63 (+70.27%)
Mutual labels:  avatar
glAvatar
a glTF extension (extra?) for avatar with switchable skeletons, skins, clothes, etc.
Stars: ✭ 30 (-18.92%)
Mutual labels:  avatar
lisk-avatar
Generate Lisk Avatars from your Lisk ID
Stars: ✭ 13 (-64.86%)
Mutual labels:  avatar
FastWaiMai
仿写美团外卖电商项目
Stars: ✭ 123 (+232.43%)
Mutual labels:  avatar
Metaverse
The Metaverse individual chain service ETP coin and immutable data space for Hyperspace.
Stars: ✭ 227 (+513.51%)
Mutual labels:  avatar
material-combiner-addon
Blender addon for material combining, uv bounds fixing
Stars: ✭ 309 (+735.14%)
Mutual labels:  avatar

Github Avatar Generator

Generate github-style avatar with java awt.

This project was inspired by gabrie-allaigre/avatar-generator.

Result Set

Dependency

The artifact has been released to center maven, simply add dependency.

<dependency>
    <groupId>com.github.afkbrb</groupId>
    <artifactId>github-avatar-generator</artifactId>
    <version>1.0.0</version>
</dependency>

API

Configuration

Method Description Default
setPadding(int padding) Set the padding of the avatar. 32
setCellCount(int cellCount) Set the number of cells of the avatar. 5
setCellSize(int cellSize) Set the size of each cell, both length and height of each cell will be set to it. 64
setForeColor(Color color) Set the foreground color of the avatar. random
setForeColors(Color... colors) Set the foreground color set, the final foreground color will be chosen at random in it. random
setForeColors(List colors) Set the foreground color set, the final foreground color will be chosen at random in it. random
setTransparent(boolean transparent) Set the transparency of the avatar. false
setBackColor(Color color) Set the background color of the avatar. Color(241, 241, 241)

Notice

The final foreground color will be decided by the last called setForeColor* method. And if none of these setForeColor* methods are called, the foreground color will be generated at random but will also meet certain conditions to make the color look nice.

Creation

Method Description
void build() Build the avatar, calling the method each time will create a new avatar image at random according to configuration.
BufferedImage generateAndGetAvatar() Generate a new avatar image and return it.
void showAvatar() Show the generated avatar image with local application.
void saveAsPNG(String filepath) Save avatar image as PNG file. The filepath include path and filename, for example, "E:/avatar.png", you should make sure that the path exists.

Example

Default

Avatar avatar = new Avatar();
avatar.showAvatar();

Save

Avatar avatar = new Avatar();
avatar.saveAsPNG("E:/avatar.png");

Set padding and cell size

AvatarConfig config = new AvatarConfig();
config.setPadding(16);
config.setCellSize(32);
Avatar avatar = new Avatar(config);
avatar.showAvatar();

Set the number of cells per row / column

config.setCellCount(8);

Set transparency

config.setTransparent(true);

Set color

config.setForeColor(Color.MAGENTA);
// config.setBackColor(Color.LIGHT_GRAY);

Set colors

config.setForeColors(Color.MAGENTA, Color.BLUE, Color.GREEN);

// the other way
List<Color> colors = new ArrayList<>();
colors.add(Color.YELLOW);
colors.add(Color.ORANGE);
colors.add(Color.CYAN);
config.setForeColors(colors);

For more example details, see example.

Licence

The Apache Software License, Version 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].