mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-14 12:19:58 +01:00
37 lines
832 B
JavaScript
37 lines
832 B
JavaScript
/*
|
|
* Display only the green channel
|
|
*/
|
|
module.exports = function GreenChannel(options) {
|
|
|
|
options = options || {};
|
|
options.title = "Green channel only";
|
|
options.description = "Displays only the green channel of an image";
|
|
var output;
|
|
|
|
//function setup() {} // optional
|
|
|
|
function draw(input,callback) {
|
|
var this_ = this;
|
|
function changePixel(r, g, b, a) {
|
|
return [0, g, 0, a];
|
|
}
|
|
function output(image,datauri,mimetype){
|
|
this_.output = {src:datauri,format:mimetype}
|
|
}
|
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
|
output: output,
|
|
changePixel: changePixel,
|
|
format: input.format,
|
|
image: options.image,
|
|
callback: callback
|
|
});
|
|
}
|
|
|
|
return {
|
|
options: options,
|
|
//setup: setup, // optional
|
|
draw: draw,
|
|
output: output
|
|
}
|
|
}
|