Small library to apply a grayscale transformation to a image
npm install image-filter-grayscale!build status


Small library to apply a grayscale transformation to a image relying on image-filter-core handle the transformation and distribute work with webworkers.
Other related modules:
* image-filter-core
* image-filter-contrast
* image-filter-grayscale
* image-filter-threshold
* image-filter-sepia
* image-filter-invert
* image-filter-gamma
* image-filter-colorize
* image-filters
```
npm install image-filter-grayscale --save
This library consumes ImageData and outputs ImageData in a Promise. You can use image-filter-core to convert from ImageData to dataURL.
JS file:
`js
var imageGrayscale = require('image-grayscale');
var nWorkers = 4;
imageGrayscale(IMAGE_DATA, 4);
`
`js`
var element = document.getElementById('#dummy-image');
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
context.drawImage(element, 0, 0 );
var imageData = context.getImageData(0, 0, element.width, element.height);
`js`
var element = document.createElement('img');
element.setAttribute('src', options.url);
//...repeat process from the previous answer
`js
var imageFilterCore = require('image-filter-core');
var nWorkers = 4;
imageGrayscale(IMAGE_DATA, nWorkers)
.then(function (result) {
// result === ImageData object
var image = document.createElement('img');
image.setAttribute('src', imageFilterCore.convertImageDataToCanvasURL(imageData));
target.appendChild(image);
});
``