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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pica-gpu

v0.2.0

Published

**GPU accelerated image resizer**

Readme

pica-gpu

GPU accelerated image resizer

npm version License: MIT

demo


Overview

Pica-gpu is a high-quality, GPU-accelerated image resizer inspired by Pica. While Pica’s original implementation runs on the CPU using JavaScript, pica-gpu leverages WebGL to offload filtering and convolution tasks to the GPU. This results in dramatically reduced CPU load and memory usage with a performance improvement of 2-10x – especially noticeable when processing large images.

Pica-gpu implements a full set of filtering algorithms (including mks2013 and others) on the GPU already.


Features

  • GPU-accelerated image scaling
    Offloads per-pixel filtering operations to the GPU via WebGL.

  • High quality filters
    Supports advanced filters (e.g. mks2013) with excellent anti-moiré and sharpening effects.

  • Improved performance
    Achieves 2-10× speedup over CPU-based Pica, with higher gains on larger images.

  • Reduced CPU and memory usage
    Avoids creating extra buffers by performing operations on the GPU.

  • Simpler implementation
    Unlike Pica, pica-gpu does not need to handle complexities such as web workers; it only requires WebGL support.

  • Simple API
    Designed to be a drop-in alternative to Pica with a similar API surface.

Installation

You can install pica-gpu via npm:

npm install pica-gpu

Usage

import { resize } from 'pica-gpu'

resize(from, to,
{
    filter,
    targetWidth,
    targetHeight,
})

API

.resize(from, to, options) -> void

Resize image from one canvas (or image) to another. Sizes are taken from source and destination objects.

  • from - source, can be HTMLCanvasElement, HTMLImageElement, ImageBitmap ImageData, OffscreenCanvas.
  • to - destination canvas, its size is supposed to be non-zero.
  • options - quality (number) or object:
    • filter - filter name (Default - mks2013). See resize_filter_info.js for details. mks2013 does both resize and sharpening, it's optimal and not recommended to change.
  • throw When an error occurs, an exception containing the corresponding information will be thrown.

(!) Because the target canvas must use a WebGL context, no other context type should be requested on it in advance. Otherwise, an error may occur, preventing the resize from working properly.