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 🙏

© 2024 – Pkg Stats / Ryan Hefner

canvas-filters

v1.0.1

Published

Base on ImageFilters.js

Downloads

397

Readme

ImageFilters.js

About

A Javascript Image filter library for the HTML5 Canvas tag.

Usage

include the library into your html.

<script type="text/javascript" src="imagefilters.js"></script>

Each filter will take an ImageData as the first parameter and always return a modified copy. Below is a basic example.

<script type="text/javascript">
  var canvas = document.getElementById('canvas_id');
  var ctx = canvas.getContext('2d');
  
  // do some drawing to your context...
  
  // create an ImageData for the area you want to apply the filter.
  var imageData = ctx.getImageData(0, 0, 300, 200);
  
  // pass it to a filter and get the modified copy
  var filtered = ImageFilters.GrayScale(imageData);
  
  // put it back into a context to view the results
  ctx.putImageData(filterd, 0, 0);
</script>

check out the Examples section for more details.

Examples

Basic usage (view source)
http://www.arahaya.com/imagefilters/usage1/

API demos
http://www.arahaya.com/imagefilters/

Ripple effect demo
http://www.arahaya.com/imagefilters/ripple/

Tested Browsers

Opera 10.50
Chrome 11.0.696.68
Firefox 3.5.4
IE 9

API List

ImageFilters.ConvolutionFilter (srcImageData, matrixX, matrixY, matrix, divisor, bias, preserveAlpha, clamp, color, alpha)
ImageFilters.Binarize (srcImageData, threshold)
ImageFilters.BlendAdd (srcImageData, blendImageData, dx, dy)
ImageFilters.BlendSubtract (srcImageData, blendImageData, dx, dy)
ImageFilters.BoxBlur (srcImageData, hRadius, vRadius, quality)
ImageFilters.GaussianBlur (srcImageData, strength)
ImageFilters.StackBlur (srcImageData, radius)
ImageFilters.Brightness (srcImageData, brightness)
ImageFilters.BrightnessContrastGimp (srcImageData, brightness, contrast)
ImageFilters.BrightnessContrastPhotoshop (srcImageData, brightness, contrast)
ImageFilters.Channels (srcImageData, channel)
ImageFilters.Clone (srcImageData)
ImageFilters.CloneBuiltin (srcImageData)
ImageFilters.ColorMatrixFilter (srcImageData, matrix)
ImageFilters.ColorTransformFilter (srcImageData, redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier, redOffset, greenOffset, blueOffset, alphaOffset)
ImageFilters.Copy (srcImageData, dstImageData)
ImageFilters.Crop (srcImageData, x, y, width, height)
ImageFilters.CropBuiltin (srcImageData, x, y, width, height)
ImageFilters.Desaturate (srcImageData)
ImageFilters.DisplacementMapFilter (srcImageData, mapImageData, mapX, mapY, componentX, componentY, scaleX, scaleY, mode)
ImageFilters.Dither (srcImageData, levels)
ImageFilters.Edge (srcImageData)
ImageFilters.Emboss (srcImageData)
ImageFilters.Enrich (srcImageData)
ImageFilters.Flip (srcImageData, vertical)
ImageFilters.Gamma (srcImageData, gamma)
ImageFilters.GrayScale (srcImageData)
ImageFilters.HSLAdjustment (srcImageData, hueDelta, satDelta, lightness)
ImageFilters.Invert (srcImageData)
ImageFilters.Mosaic (srcImageData, blockSize)
ImageFilters.Oil (srcImageData, range, levels)
ImageFilters.OpacityFilter (srcImageData, opacity)
ImageFilters.Posterize (srcImageData, levels)
ImageFilters.Rescale (srcImageData, scale)
ImageFilters.Resize (srcImageData, width, height)
ImageFilters.ResizeNearestNeighbor (srcImageData, width, height)
ImageFilters.Sepia srcImageData)
ImageFilters.Sharpen (srcImageData, factor)
ImageFilters.Solarize (srcImageData)
ImageFilters.Transpose (srcImageData)
ImageFilters.Twril (srcImageData, centerX, centerY, radius, angle, edge, smooth)