mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-11 19:00:00 +01:00
Make progress bars on UI true (#1112)
* Make progress bars on UI true Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update docs Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix typo Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
committed by
Jeffrey Warren
parent
f5d7b0ae09
commit
80cb5b1194
@@ -280,6 +280,8 @@ module.exports = function ModuleName(options,UI) {
|
|||||||
|
|
||||||
The `progressObj` parameter of `draw()` is not consumed unless a custom progress bar needs to be drawn, for which this default spinner should be stopped with `progressObj.stop()` and image-sequencer is informed about the custom progress bar with `progressObj.overrideFlag = true;` following which this object can be overriden with custom progress object.
|
The `progressObj` parameter of `draw()` is not consumed unless a custom progress bar needs to be drawn, for which this default spinner should be stopped with `progressObj.stop()` and image-sequencer is informed about the custom progress bar with `progressObj.overrideFlag = true;` following which this object can be overriden with custom progress object.
|
||||||
|
|
||||||
|
The pixelManipulation API can draw progress bars internally using the `pace` npm package. The option is disabled by default but can be enabled by passing `ui: true` in the options for pixelManipulation. The recommended way is to use `ui: options.step.ui`. This will only show the progress if the ui is set to true by the user, while creating the sequencer object.
|
||||||
|
|
||||||
### Module example
|
### Module example
|
||||||
|
|
||||||
See existing module `channel` for an example: https://github.com/publiclab/image-sequencer/blob/main/src/modules/Channel/Module.js
|
See existing module `channel` for an example: https://github.com/publiclab/image-sequencer/blob/main/src/modules/Channel/Module.js
|
||||||
|
|||||||
2
index.js
2
index.js
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
require('./src/ImageSequencer');
|
require('./src/ImageSequencer');
|
||||||
sequencer = ImageSequencer({ ui: false });
|
sequencer = ImageSequencer({ ui: true });
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var program = require('commander');
|
var program = require('commander');
|
||||||
var utils = require('./src/CliUtils');
|
var utils = require('./src/CliUtils');
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ module.exports = function AddQR(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ module.exports = function Average(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ module.exports = function Dynamic(options, UI, util) {
|
|||||||
// run PixelManipulatin on second image's pixels
|
// run PixelManipulatin on second image's pixels
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ module.exports = function Blur(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ module.exports = function Brightness(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui, //don't pass this in if you don't want your module to support progress bars
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ module.exports = function canvasResize(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ module.exports = function Channel(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ module.exports = function ColorTemperature(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ module.exports = function Colormap(options, UI) {
|
|||||||
}
|
}
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ module.exports = function Contrast(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ module.exports = function Convolution(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ module.exports = function DoNothing(options, UI) {
|
|||||||
}
|
}
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
callback: callback
|
callback: callback
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ module.exports = function Dither(options, UI){
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ module.exports = function DrawRectangle(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ module.exports = function Dynamic(options, UI) {
|
|||||||
}
|
}
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
getNeighbourPixel: getNeighbourPixel,
|
getNeighbourPixel: getNeighbourPixel,
|
||||||
getNeighborPixel: getNeighbourPixel,
|
getNeighborPixel: getNeighbourPixel,
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ module.exports = function edgeDetect(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ module.exports = function Exposure(options, UI){
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ module.exports = function FlipImage(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ module.exports = function Gamma(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ module.exports = function GridOverlay(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ module.exports = function Channel(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ module.exports = function Ndvi(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ module.exports = function NoiseReduction(options, UI){
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ module.exports = function Dynamic(options, UI, util) {
|
|||||||
// run PixelManipulation on first Image pixels
|
// run PixelManipulation on first Image pixels
|
||||||
return require('../_nomodule/PixelManipulation.js')(baseStepOutput, {
|
return require('../_nomodule/PixelManipulation.js')(baseStepOutput, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: baseStepOutput.format,
|
format: baseStepOutput.format,
|
||||||
image: baseStepImage,
|
image: baseStepImage,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ module.exports = function PaintBucket(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ module.exports = function ReplaceColor(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ module.exports = function Resize(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ module.exports = function Rotate(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ module.exports = function Saturation(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ module.exports = function TextOverlay(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
@@ -48,4 +49,3 @@ module.exports = function TextOverlay(options, UI) {
|
|||||||
UI: UI
|
UI: UI
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -28,6 +28,7 @@ module.exports = function ImageThreshold(options, UI) {
|
|||||||
}
|
}
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ module.exports = function Tint(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
changePixel: changePixel,
|
changePixel: changePixel,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ module.exports = function Balance(options, UI) {
|
|||||||
|
|
||||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||||
output: output,
|
output: output,
|
||||||
|
ui: options.step.ui,
|
||||||
extraManipulation: extraManipulation,
|
extraManipulation: extraManipulation,
|
||||||
format: input.format,
|
format: input.format,
|
||||||
image: options.image,
|
image: options.image,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module.exports = function PixelManipulation(image, options) {
|
|||||||
// TODO: this could possibly be more efficient; see
|
// TODO: this could possibly be more efficient; see
|
||||||
// https://github.com/p-v-o-s/infragram-js/blob/master/public/infragram.js#L173-L181
|
// https://github.com/p-v-o-s/infragram-js/blob/master/public/infragram.js#L173-L181
|
||||||
|
|
||||||
if (!options.inBrowser && !process.env.TEST) {
|
if (!options.inBrowser && !process.env.TEST && options.ui) {
|
||||||
try {
|
try {
|
||||||
var pace = require('pace')(pixels.shape[0] * pixels.shape[1]);
|
var pace = require('pace')(pixels.shape[0] * pixels.shape[1]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -63,7 +63,7 @@ module.exports = function PixelManipulation(image, options) {
|
|||||||
pixels.set(x, y, 2, pixel[2]);
|
pixels.set(x, y, 2, pixel[2]);
|
||||||
pixels.set(x, y, 3, pixel[3]);
|
pixels.set(x, y, 3, pixel[3]);
|
||||||
|
|
||||||
if (!options.inBrowser && !process.env.TEST) pace.op();
|
if (!options.inBrowser && !process.env.TEST && options.ui) pace.op();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user