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

pixl-curves

v1.0.0

Published

Apply Photoshop-style curves using HTML5 Canvas.

Readme

Overview

Screenshot

Read the accompanying blog article here: Creating a Photoshop-style Curves Filter for HTML5 Canvas

The Curves filter is one of the most powerful tonal adjustment tools in image editing. Popularized by Adobe Photoshop® and now present in nearly every photo editor, curves let you remap the image tonality, specified as a function from input level to output level.

Conceptually, you can think of curves like an audio equalizer but for images: each point along the horizontal axis represents an input brightness, and the vertical axis determines the new output brightness. By shaping the curve, you can emphasize detail in shadows, compress highlights, adjust midtones, or even produce stylized effects.

This library generates curves for you, and renders them to any HTML5 Canvas. It also provides a variety of adjustment functions (i.e. pre-built curves), for things like brightness, contrast, exposure, gamma, and many more.

Features

  • Zero dependencies.
  • Lightweight (11K minified, 2K gzipped).
  • Apply any curve by specifying points.
  • Renders directly atop any HTML5 Canvas.
  • Basic adjustments such as brightness, contrast, etc.
  • Advanced adjustments such as shadows, midtones, highlights.
  • Photographic filters such as exposure, gamma.
  • Special filters including posterize, threshold, sepia.
  • Auto-enhance filter (a.k.a. normalize).
  • Generate image histograms.

Usage

Use npm to install the module:

npm install pixl-curves

If you are building a vanilla JS app, you can just host the curves.min.js file and load it via a SCRIPT tag. A global Curve object is exposed. If you are using a bundler, include the module in your package.json file and require it as per usual. The Curve class is exported directly as module.exports.

Here is a simple usage example:

// Create a canvas and add to dom
let canvas = document.createElement('canvas');
let context = canvas.getContext('2d');
canvas.width = 1024;
canvas.height = 752;
document.body.appendChild(canvas);

// load a sample image
let img = new Image();

img.onload = function() {
	// draw image on canvas
	context.clearRect( 0, 0, canvas.width, canvas.height );
	context.drawImage( img, 0, 0 );
	
	// create curve
	let curve = new Curve(canvas);
	
	// bump midtones and posterize
	curve.midtones(32).posterize(4).render();
};

// trigger load
img.crossOrigin = 'anonymous';
img.src = 'https://pixlcore.com/software/pixl-curves/sample.webp';

All of the class methods are chainable (each returns the object instance), so you can do things like:

curve.brightness(125).contrast(150).render();

Some methods accept a single number as the argument, but all accept an options object. See the API below for more details.

For a custom curve, use apply() and specify which channel(s) you want (rgb is an alias for all channels):

curve.apply({ rgb: [ 0, 192, 255 ] }).render();

API

See API.md for the full API docs.

Development

To build pixl-curves from source, use the included build script, which you can invoke from NPM like this:

npm run build

This reads the source files and produces the single output file curves.min.js.

To generate the API docs, use this command:

npm run docs

License

The MIT License (MIT)

Copyright (c) 2025 Joseph Huckaby and PixlCore.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Code from Wikipedia

This library relies on some sample code adapted from a Wikipedia article:

https://en.wikipedia.org/wiki/Monotone_cubic_interpolation

I am mentioning this here because the license of the code is unspecified.