Add contrast module (#463)

This commit is contained in:
Mridul97
2018-11-13 22:52:48 +05:30
committed by Jeffrey Warren
parent 4576e497db
commit 4bdc5b6583
7 changed files with 318 additions and 90 deletions

View File

@@ -0,0 +1,49 @@
// /*
// * Changes the Image Contrast
// */
module.exports = function Contrast(options, UI) {
options.contrast = options.contrast || 70
var output;
function draw(input, callback, progressObj) {
progressObj.stop(true);
progressObj.overrideFlag = true;
var step = this;
function changePixel(r, g, b, a) {
return [r, g, b, a]
}
function extraManipulation(pixels) {
pixels = require('./Contrast')(pixels, options.contrast)
return pixels
}
function output(image, datauri, mimetype) {
// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };
}
return require('../_nomodule/PixelManipulation.js')(input, {
output: output,
changePixel: changePixel,
extraManipulation: extraManipulation,
format: input.format,
image: options.image,
callback: callback
});
}
return {
options: options,
draw: draw,
output: output,
UI: UI
}
}