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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pixelizerjs

v1.4.0

Published

A single-file, palette-based pixelization and dithering library for JavaScript in the browser.

Readme

pixelizer.js

A single-file, palette-based pixelization and dithering library for JavaScript in the browser.

pixelizer.js renders an image through a configurable color palette, optionally applies Bayer dithering, and produces a retro-inspired result. It can be used as a standalone image processor, integrated into custom WebGL pipelines, or attached as a post-processing effect in Three.js, Babylon.js, and p5.js.

Features

  • Palette-based color quantization
  • Optional Bayer dithering
  • Runtime palette switching
  • Runtime pixel size adjustment
  • Raw WebGL shader access
  • Three.js post-processing integration
  • No external dependencies for core functionality

Installation

Just copy pixelizer.js into your project or install using:

npm install pixelizerjs

In that case, you will need to import "pixelizerjs" instead of "./pixelizer.js". The following examples use the latter.

Examples

Boring

import makePixelizer from "./pixelizer.js";

const pixelizer = makePixelizer();
const output =
  pixelizer.pixelize(imageBitmap);

By default, pixelizer.js uses the Resurrect64 color palette by Kerrie Lake on Lospec, a 5x5 pixel size, with dithering enabled. You can change this by using options!

Custom options

const pixelizer = makePixelizer({
  initialSqSize: 2, // 2x2px square size
  dithering: true, // set to false if you like
  palette: [
    // (h3Rry F!z by ID Rando on Lospec
    "0d0a19",
    "ed2443",
    "58b6ef",
    "f3ecdd",
  ],
});

Three.js

Three.js is only required if you want to use the Three.js features. If you're just using the other parts, it is not needed.

You may need to set up an importmap.

import * as THREE from "three";
import { EffectComposer } from "three/examples/jsm/postprocessing/EffectComposer.js";
import { RenderPass } from "three/examples/jsm/postprocessing/RenderPass.js";
import { asThreeJS } from "./pixelizer.js";

const canvas = document.querySelector("#bg");

const renderer = new THREE.WebGLRenderer({
  canvas,
  antialias: true,
});

renderer.setSize(
  window.innerWidth,
  window.innerHeight
);

renderer.setPixelRatio(
  window.devicePixelRatio
);

const scene = new THREE.Scene();

const camera = new THREE.PerspectiveCamera(
  75,
  window.innerWidth / window.innerHeight,
  0.1,
  1000
);

camera.position.setZ(30);
camera.position.setX(-3);

const composer =
  new EffectComposer(renderer);

composer.addPass(
  new RenderPass(scene, camera)
);

composer.addPass(
  await asThreeJS({
    initialSqSize: 5,
    palette: [
      // MAGENTA ST by Leonardo, a rejected palette from Lospec
      "ffffff",
      "ffe5ff",
      "ffccff",
      "ffb2ff",
      "ff99ff",
      "ff7fff",
      "ff65ff",
      "ff4cff",
      "ff19ff",
      "ff32ff",
      "ff00ff",
      "e500e5",
      "cc00cc",
      "b200b2",
      "990099",
      "190019",
      "000000",
    ],
    dithering: true,
  })
);

Low-level access

[!CAUTION] YOU ARE ENTERING A VERY TECHNICAL AREA. IF YOU DO NOT UNDERSTAND, STAY CALM AND SCROLL PAST.

import { getWebGLSource } from "./pixelizer.js";

const {
  vertexShader,
  fragmentShader,
} = getWebGLSource({
  dithering: true,
});

// bla bla WebGL shader compilation etc.

A Note from the Author (tiash-and-cats)

pixelizer.js is intentionally palette-driven.

The shader is only part of the final look. Different palettes can dramatically change the atmosphere of a scene, ranging from subtle retro rendering to aggressive posterization.

Please experiment with palettes, pixel sizes, and dithering settings to develop a unique visual identity.

I do not want pixelizer.js to become known for a repetitive visual style, so please don't all use the same cookie-cutter config. The defaults are intended as a starting point.