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

depixel

v1.0.5

Published

Depixelizing Pixel Art by Kopf-Lischinski and Felix Kreuzer for Node.js

Readme

Kopf-Lischinski "Depixelizing Pixel Art" for Node.js

Based on the following paper:

And the source code included with this paper:

Improvements upon original GPU version:

  • Add a threshold parameter to adjust how close two colors need to be to be consider similar
  • Better handle alpha channels (treat as dissimilar from non-transparent pixels)
  • Fix stretching/scaling due to texel misalignment
  • Add option to pass in a similarity map
    • Relatedly, renderMode:similarityMask outputs a scaled up similarity map (for use in post-processing, etc)

Notes

  • Original GPU code is MIT licensed, the same license may apply here, all original code in this project is additionally released under the MIT License
  • Most GPU code semi-automatically converted to JavaScript by Codex (AI)
  • Example below is expanded to 12x via Depixel and then shrunk by 2x with linear filtering (e.g. 2xAA)

API

type Image = {
  data: Buffer; // Or Uint8Array - pixels in RGBA byte order
  width: number;
  height: number;
  similarityData?: Buffer;
};

type Opts = {
  height: number;
  threshold?: number; // 0..255, lower = fewer similarity edges; default 255
  // borderPx - pad input with this many pixels (1-2) - useful with
  //   `threshold=0` for complete hard edges
  borderPx?: number;
  // if `similarity` specified, uses values here instead or RGBA values to
  //   determine similarity.  Note: `threshold` (default 3) is used against sum
  //   of RGB differences in this buffer instead the default of using a
  //   perceptual threshold based on color
  // note: color still impacts shape of splines
  similarity?: Buffer;
  // if `outputSimilarityMask` and `similarity` is specified,
  //   then `similarityData` in the return will contain a scaled up version of
  //   the `similarity` mask (for use in post-processing, etc
  outputSimilarityMask?: boolean; // default false
  renderMode?: 'splines' | 'default'; // default default
  doOpt?: boolean; // default true
}

function scaleImage(src: Image, opts: Opts): Image;

Example usage

const { scaleImage } = require('depixel');

let src = new Uint32Array([
  // White on black "x"
  0xFFFFFFFF, 0x000000FF, 0xFFFFFFFF,
  0x000000FF, 0xFFFFFFFF, 0x000000FF,
  0xFFFFFFFF, 0x000000FF, 0xFFFFFFFF,
]);

let result = scaleImage({
  data: src,
  width: 3,
  height: 3,
}, {
  height: 3 * 6,
});

See test/test.js for an example including reading and writing from a PNG file.

Links

  • https://johanneskopf.de/publications/pixelart/
  • https://github.com/falichs/Depixelizing-Pixel-Art-on-GPUs
  • https://www.cg.tuwien.ac.at/research/publications/2014/KREUZER-2014-DPA/