Skip to content
replace grayscale with color from a colormap (uses ndarray)
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
.travis.yml
README.md
demo.js
index.js
package.json
test.js

README.md

graycolorize

Replace grayscale with color from a colormap

Build Status

Usage:

var graycolorize = require('graycolorize');

graycolorize(pixels, colormap);

where pixels is an ndarray of pixels (e.g., loaded by get-pixels). colormap is a 256x4 ndarray of RGBA colors for each 256 grayscale colors to replace.

You can create the colormap yourself or call graycolorize.generateMap(hue, saturation) to generate one for you, with the given hue and saturation (0-1) from minimum to maximum brightness:

var colormap = graycolorize.generateMap(0.25, 0.5);

Example (see demo.js or run npm start):

screenshot

License

MIT

Something went wrong with that request. Please try again.