Adds "Add QR" module (#736)

* Adds Add QR module

* Grunt build changes

* Rremoved copyPixels function and added test for QR module

* Resolved test fail issues

* Adds look same test

* Change default to get from info.json
This commit is contained in:
Slytherin
2019-02-21 23:32:24 +05:30
committed by Jeffrey Warren
parent 600ddece58
commit 6dd7738476
12 changed files with 10734 additions and 7260 deletions

View File

@@ -67,14 +67,15 @@ module.exports = function PixelManipulation(image, options) {
}
}
}
// perform any extra operations on the entire array:
if (options.extraManipulation) pixels = options.extraManipulation(pixels);
var res;
if (options.extraManipulation) res = options.extraManipulation(pixels,generateOutput);
// there may be a more efficient means to encode an image object,
// but node modules and their documentation are essentially arcane on this point
var chunks = [];
function generateOutput(){
var chunks = [];
var totalLength = 0;
var r = savePixels(pixels, options.format, { quality: 100 });
r.on("data", function(chunk) {
@@ -89,5 +90,11 @@ module.exports = function PixelManipulation(image, options) {
options.output(options.image, datauri, options.format);
if (options.callback) options.callback();
});
}
if(res){
pixels=res;
generateOutput();
}
else if(!options.extraManipulation) generateOutput();
});
};