Converts an RGB image to grayscale
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples upgrade to ndarray 1.0 Jun 26, 2013
test upgrade to cwise 1.0.0 Apr 29, 2014
.gitignore adding files May 15, 2013
.npmignore upgrade to ndarray 1.0 Jun 26, 2013
LICENSE adding files May 15, 2013
README.md ready to publish May 15, 2013
lum.js fixed pick Aug 15, 2013
package.json 1.0.2 Apr 29, 2014

README.md

luminance

Converts an RGB image into a grayscale luminance image. This is built on the ndarray library.

Example

//Load up a test image
var lena = require("lena")

//Convert to grayscale
var grayscale_lena = require("luminance")(lena)

//Write the resulting png to stdout
require("save-pixels")(grayscale_lena, "png").pipe(process.stdout)

Which creates the following image:

Install

npm install luminance

API

var luminance = require("luminance")

luminance(img)

Returns A gray scale version of img

luminance(result, img)

Returns A gray scale version of img, the result is stored in result

luminance(red, green, blue)

Returns A gray scale image with red, green and blue channels in the given ndarrays

luminance(result, red, green, blue)

Returns A luminance image of red/green/blue with result stored in result.

Credits

(c) 2013 Mikola Lysenko. MIT License