Files
image-sequencer/src/modules/Resize/Module.js
Rishabh Shukla d33afe09da refactored resize (#1562)
Co-authored-by: h <f>
Co-authored-by: Harsh Khandeparkar <34770591+HarshKhandeparkar@users.noreply.github.com>
Co-authored-by: Jeffrey Warren <jeff@unterbahn.com>
2020-10-16 10:04:59 +05:30

45 lines
1.0 KiB
JavaScript

/*
* Resize the image by given percentage value
*/
module.exports = function Resize(options, UI) {
let output;
function draw(input, callback, progressObj) {
const defaults = require('./../../util/getDefaults.js')(require('./info.json'));
options.resize = options.resize || defaults.resize;
progressObj.stop(true);
progressObj.overrideFlag = true;
const step = this;
function extraManipulation(pixels) {
return require('./Resize')(pixels, options);
}
function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}
return require('../_nomodule/PixelManipulation.js')(input, {
output: output,
ui: options.step.ui,
extraManipulation: extraManipulation,
format: input.format,
image: options.image,
inBrowser: options.inBrowser,
callback: callback,
useWasm:options.useWasm
});
}
return {
options: options,
draw: draw,
output: output,
UI: UI
};
};