luminance

Convert RGB to grayscale

luminance

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

//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:

npm install luminance
var luminance = require("luminance")

Returns A gray scale version of img

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

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

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

(c) 2013 Mikola Lysenko. MIT License