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

jsgui3-gfx-core

v0.0.26

Published

**Pure-JavaScript pixel buffer library.** Data structures and algorithms for creating, manipulating, and processing raster images as typed arrays. No Canvas, no DOM — runs identically in Node.js and browsers.

Readme

jsgui3-gfx-core

Pure-JavaScript pixel buffer library. Data structures and algorithms for creating, manipulating, and processing raster images as typed arrays. No Canvas, no DOM — runs identically in Node.js and browsers.

Install

npm install jsgui3-gfx-core

Quick Start

const { Pixel_Buffer, Pixel_Buffer_Painter, convolution_kernels } = require('jsgui3-gfx-core');

// Create a 256×256 RGB pixel buffer
const pb = new Pixel_Buffer({ bits_per_pixel: 24, size: [256, 256] });

// Fill with a base color
pb.color_whole([20, 30, 80]);

// Draw rectangles with the Painter (fluent API)
const painter = new Pixel_Buffer_Painter({ pb });
painter
    .rect([30, 30], [80, 40], [255, 60, 60])
    .rect([60, 50], [80, 40], [60, 200, 60])
    .rect([90, 70], [80, 40], [60, 60, 255]);

// Apply edge detection
const grey = pb.to_8bipp();
const edges = grey.apply_square_convolution(
    new Float32Array(convolution_kernels.edge)
);

Features

| Feature | Description | |---------|-------------| | Pixel Buffers | 1bipp, 8bipp, 24bipp, 32bipp — all backed by Uint8Array | | Drawing | Lines (Bresenham), filled polygons (scanline), rectangles | | Convolution | Edge detection, Gaussian blur, Sobel, custom kernels | | Format Conversion | Greyscale ↔ RGB ↔ RGBA, threshold to binary | | Resize | Area-weighted sampling for quality downscaling | | Masking | 1bipp masks for compositing and region operations | | Typed Array Math | Low-level bitwise, copy, fill, and transform operations | | Shapes | Rectangle and Polygon geometry classes |

Exports

const {
    Pixel_Buffer,          // Full-featured pixel buffer (10-layer class hierarchy)
    Pixel_Buffer_Painter,  // Fluent rectangle drawing API
    Pixel_Pos_List,        // Sparse pixel coordinate storage
    convolution_kernels,   // Predefined convolution kernels
    ta_math,               // TypedArray math operations
    Rectangle, Rect        // Rectangle geometry
} = require('jsgui3-gfx-core');

Supported Bit Depths

| Format | bits_per_pixel | Use Case | |--------|-----------------|----------| | 1bipp | 1 | Binary masks, thresholds | | 8bipp | 8 | Greyscale images | | 24bipp | 24 | RGB color images | | 32bipp | 32 | RGBA with transparency |

Convolution Kernels

convolution_kernels.edge            // 3×3 edge detection
convolution_kernels.sobel_x         // 3×3 horizontal Sobel
convolution_kernels.sobel_y         // 3×3 vertical Sobel
convolution_kernels.lap_gauss_5     // 5×5 Laplacian of Gaussian
convolution_kernels.gauss_blur_5_2  // 5×5 Gaussian blur (σ=2)

// Generate custom Gaussian kernel
convolution_kernels.get_gaussian_kernel(7, 3)  // 7×7, σ=3

Integration

Works with Sharp (Node.js) and Canvas (browser):

// Sharp → Pixel_Buffer
const { data, info } = await sharp('input.png').raw().toBuffer({ resolveWithObject: true });
const pb = new Pixel_Buffer({ bits_per_pixel: info.channels * 8, size: [info.width, info.height], ta: new Uint8Array(data.buffer) });

// Canvas → Pixel_Buffer
const imageData = ctx.getImageData(0, 0, w, h);
const pb = new Pixel_Buffer({ bits_per_pixel: 32, size: [w, h], ta: new Uint8Array(imageData.data.buffer) });

Documentation

Full documentation with SVG illustrations available in docs/:

  1. Introduction & Overview
  2. Installation & Getting Started
  3. Architecture & Class Hierarchy
  4. Pixel Buffer API Reference
  5. Drawing — Lines, Polygons, Rectangles
  6. Convolution & Image Processing
  7. TypedArray Math Subsystem
  8. Shapes, Pixel_Pos_List & Utilities
  9. Ecosystem & Integration
  10. Dense Agent Reference

Dependencies

| Package | Purpose | |---------|---------| | lang-mini | Type checking, iteration, comparison | | obext | Read-only and managed property definitions | | fnl | Functional utilities |

Testing

npm test

License

MIT