Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Pixel avatar (npm-like) generator.
This module using strings as ceed for generator. There are some examples:
Some random string (with 3 colors):
admin (with 2 colors):
username (with 2 colors):
npm install --save avatars
Basic promise usage:
var avatars = require('avatars');
avatars()
.then(image => {
image.write("./text.png", (err) => {
if (err) throw err;
console.log("Created text.png");
});
})
.catch(e => console.error(e));
Basic callback usage:
var avatars = require('avatars');
avatars(null, function(error, image) {
if (error) throw error;
image.write("./text.png", (err) => {
if (err) throw err;
console.log("Created text.png");
});
});
First argument of avatars() is parameters object for image generation. Avatars return image object that is created by Jimp module.
Parameter | Description |
---|---|
ceed | Some string that will be used as a ceed for randomizer (default: random string) |
width | Width of the output image in px (default: 256) |
height | Height of the output image in px (default: 256) |
pwidth | Width of the generated pattern in cells (default: 16) |
pheight | Height of the generated pattern in cells (default: 16) |
filename | Filename to write the image (default: null) |
var avatars = require('avatars');
var params = {
ceed: 'Some Random Name', // can be username, login, id etc
width: 500,
height: 500,
pwidth: 15,
pheight: 15,
filename: './test.png' // file with this name will be created
};
avatars(params)
.then(image => {
console.log("Created text.png");
})
.catch(e => console.error(e));
FAQs
Pixel avatar generator
The npm package avatars receives a total of 3 weekly downloads. As such, avatars popularity was classified as not popular.
We found that avatars 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.