Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
avatar-builder
Advanced tools
Readme
Avatar builder, build multi avatar (cat, github, 8bit, square, identicon, etc) or compose avatar
npm install avatar-builder --save
const Avatar = require('avatar-builder');
const avatar = Avatar.builder(Avatar.Image.margin(Avatar.Image.circleMask(Avatar.Image.identicon())),128,128, {cache: Avatar.Cache.lru()});
avatar.create('gabriel').then(buffer => fs.writeFileSync('avatar-gabriel.png', buffer));
avatar.create('allaigre').then(buffer => fs.writeFileSync('avatar-allaigre.png', buffer));
Content typescript definition
More example in sample.js
Example 1 :
const Avatar = require('avatar-builder');
const avatar = Avatar.triangleBuilder(128);
avatar.create('gabriel').then(buffer => {/* png buffer */});
Source : https://github.com/flouthoc/minBlock.js
Example 1 :
const Avatar = require('avatar-builder');
const avatar = Avatar.squareBuilder(128);
avatar.create('gabriel').then(buffer => {/* png buffer */});
Source : https://github.com/donpark/identicon
Example 1 :
const Avatar = require('avatar-builder');
const avatar = Avatar.identiconBuilder(128);
avatar.create('gabriel').then(buffer => {/* png buffer */});
Example 1 :
const Avatar = require('avatar-builder');
const avatar = Avatar.githubBuilder(128);
avatar.create('gabriel').then(buffer => {/* png buffer */});
Images sources : CC-By 4.0 attribution: David Revoy https://framagit.org/Deevad/cat-avatar-generator
Example 1 :
const Avatar = require('avatar-builder');
const avatar = Avatar.catBuilder(128);
avatar.create('gabriel').then(buffer => {/* png buffer */});
Example 2 :
const Avatar = require('avatar-builder');
const avatar = Avatar.builder(
Avatar.Image.margin(Avatar.Image.roundedRectMask(Avatar.Image.compose(
Avatar.Image.randomFillStyle(),
Avatar.Image.shadow(Avatar.Image.margin(Avatar.Image.cat(), 8), {blur: 5, offsetX: 2.5, offsetY: -2.5,color:'rgba(0,0,0,0.75)'})
), 32), 8),
128, 128);
avatar.create('gabriel').then(buffer => {/* png buffer */});
Images sources : https://github.com/o1egl/govatar
Example 1 :
const Avatar = require('avatar-builder');
const avatar = Avatar.male8bitBuilder(128);
avatar.create('gabriel').then(buffer => {/* png buffer */});
Example 2 :
const Avatar = require('avatar-builder');
const avatar = Avatar.female8bitBuilder(128);
avatar.create('gabriel').then(buffer => {/* png buffer */});
Compose cache
Example, cache with lru and folder
const Avatar = require('avatar-builder');
const avatar = Avatar.catBuilder(128, { cache: Avatar.Cache.compose(Avatar.Cache.lru(), Avatar.Cache.folder()) });
avatar.create('gabriel').then(buffer => {/* png buffer */});
function | description |
---|---|
Avatar.builder(image,width,height,options) | Create a avatar builder with image builder and size and options |
Avatar.catBuilder(size,options) | Create a cat avatar builder with size and options |
Avatar.githubBuilder(size,precision,options) | Create a github avatar builder with size and options |
Avatar.triangleBuilder(size,prevision,colors,options) | Create a triangle avatar builder with size and options |
Avatar.identiconBuilder(size,options) | Create a identicon avatar builder with size and options |
Avatar.squareBuilder(size,precision,colors,options) | Create a square avatar builder with size and options |
Avatar.female8bitBuilder(size,options) | Create a 8bit female avatar builder with size and options |
Avatar.male8bitBuilder(size,options) | Create a 8bit male avatar builder with size and options |
function | description |
---|---|
Avatar.Image.compose(images) | Compose images |
Avatar.Image.random(images) | Choose random image in list |
Avatar.Image.margin(image,margin) | Add margin to image |
Avatar.Image.fillStyle(fillStyle) | Solid image with color |
Avatar.Image.randomFillStyle(fillStyles) | Solid image with random color |
Avatar.Image.circleMask(image) | Circle mask |
Avatar.Image.roundedRectMask(image,radius) | Rounded rect mask |
Avatar.Image.shadow(image,shadow) | Add shadow below image |
Avatar.Image.scoreShadow(image,shadowColor) | Add score shadow above image |
Avatar.Image.longShadow(image,shadowColor) | Add long shadow below image |
Avatar.Image.group(pathLocation,groups) | Compose png by group |
Avatar.Image.identicon(patchSize,backgroundColor) | Create a identicon image |
Avatar.Image.square(precision,colors) | Create mini block image |
Avatar.Image.triangle(precision,colors) | Create triangle image |
Avatar.Image.github(precision) | Create github image |
Avatar.Image.cat() | Create cat image |
Avatar.Image.male8bit() | Create male 8bit image |
Avatar.Image.female8bit() | Create female 8bit image |
Avatar.Image.grid(image,gridx,gridy) | Create grid with gridx * gridy images |
function | description |
---|---|
Avatar.Cache.memory() | Use memory cache, all elements in map |
Avatar.Cache.lru(options) | Use LRU cache (default max 50 elements) |
Avatar.Cache.folder(location) | Save element in folder (default ./tmp/avatar) |
Avatar.Cache.compose(caches) | Compose multi cache |
FAQs
Create a beautiful avatar for nodejs
The npm package avatar-builder receives a total of 26 weekly downloads. As such, avatar-builder popularity was classified as not popular.
We found that avatar-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.