mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-12 03:10:03 +01:00
Minimize mod req (#289)
* remove trailing spaces from Run.js Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * minimize module requirements demonstrated with invert fixes #122 Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * refactored modules Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update docs Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * remove all trailing spaces from all files Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fixing crop module Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update contributing.md Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
committed by
Jeffrey Warren
parent
5132612dc2
commit
8d6b82d988
@@ -2,30 +2,24 @@
|
||||
* Average all pixel colors
|
||||
*/
|
||||
module.exports = function Average(options, UI){
|
||||
options = options || {};
|
||||
|
||||
options.blur = options.blur || 2
|
||||
|
||||
//Tell the UI that a step has been set up
|
||||
UI.onSetup(options.step);
|
||||
var output;
|
||||
|
||||
options.step.metadata = options.step.metadata || {};
|
||||
|
||||
|
||||
function draw(input,callback,progressObj){
|
||||
|
||||
progressObj.stop(true);
|
||||
progressObj.overrideFlag = true;
|
||||
|
||||
// Tell the UI that a step is being drawn
|
||||
UI.onDraw(options.step);
|
||||
|
||||
|
||||
var step = this;
|
||||
|
||||
|
||||
function changePixel(r, g, b, a){
|
||||
return [r,g,b,a]
|
||||
}
|
||||
|
||||
// do the averaging
|
||||
// do the averaging
|
||||
function extraManipulation(pixels){
|
||||
var sum = [0,0,0,0];
|
||||
for (var i = 0; i < pixels.data.length; i += 4) {
|
||||
@@ -55,20 +49,14 @@ module.exports = function Average(options, UI){
|
||||
}
|
||||
|
||||
function output(image, datauri, mimetype){
|
||||
|
||||
|
||||
// This output is accessible by Image Sequencer
|
||||
step.output = {
|
||||
src: datauri,
|
||||
format: mimetype
|
||||
};
|
||||
|
||||
// This output is accessible by UI
|
||||
options.step.output = datauri;
|
||||
|
||||
// Tell UI that step has been drawn.
|
||||
UI.onComplete(options.step);
|
||||
}
|
||||
|
||||
|
||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||
output: output,
|
||||
changePixel: changePixel,
|
||||
@@ -77,7 +65,7 @@ module.exports = function Average(options, UI){
|
||||
image: options.image,
|
||||
callback: callback
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
return {
|
||||
options: options,
|
||||
|
||||
Reference in New Issue
Block a user