npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

randpix

v1.1.1

Published

Fastest pixel avatar generator

Downloads

3

Readme

Fastest random pixel avatar generator

  • ~8000 pixel arts per second
  • Many color schemes
  • Very simple
  • Browser support

Live demo

Installing Canvas for Randpix

| OS | Command | |---------|----------------------------------------------------------------------------------------------------------| | OS X | Using Homebrew:brew install pkg-config cairo pango libpng jpeg giflib librsvg | | Ubuntu | sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev | | Fedora | sudo yum install gcc-c++ cairo-devel pango-devel libjpeg-turbo-devel giflib-devel | | Solaris | pkgin install cairo pango pkg-config xproto renderproto kbproto xextproto | | OpenBSD | doas pkg_add cairo pango png jpeg giflib | | Windows | See the wiki | | Others | See the wiki |

Example

import { randpix, RandpixColorScheme, Symmetry } from 'randpix'

const generate = randpix({
  colorScheme: RandpixColorScheme.DARKULA, // Color theme (default: NEUTRAL)
  size: 8, // Art size. Recommended 7 or 8 (odd/even symmetry) (default: 8)
  scale: 32, // Pixel scale (default: 1)
  symmetry: Symmetry.VERTICAL, // Symmetry (default: VERTICAL)
  color: [255, 100, 50], // [R, G, B] like color for solid art (default: undefined),
  seed: 'Some string', // Seed (default: undefined)
  colorBias: 15, // Slightly changes the color hue, which adds more color to the image (default: undefined)
  grayscaleBias: false // Change only the brightness of the color instead of the hue (default: undefined)
})

const art = generate() // Generating the pixel art

const pngBuffer = art.toBuffer('image/png')
const dataURL = art.toDataURL()

Custom color scheme

const customColorScheme = [
  // [R, G, B, C], C is the frequency of this color appearing in the pixel art
  [151, 219, 174, 1],
  [195, 229, 174, 0.5],
  [241, 225, 166, 0.5],
  [244, 187, 187, 0.2],
]

My Benchmarks

With defaults: 0.11812 ms/art. Speed: 8465 arts/s
With scale 32: 0.14147 ms/art. Speed: 7068 arts/s
With bias 15: 0.11686 ms/art. Speed: 8557 arts/s
With full fill: 0.21214 ms/art. Speed: 4713 arts/s
With quarter fill: 0.06061 ms/art. Speed: 16497 arts/s
With quad symmetry: 0.11023 ms/art. Speed: 9072 arts/s
With solid color: 0.10263 ms/art. Speed: 9744 arts/s
Every instanced: 0.15031 ms/art. Speed: 6652 arts/s