From 2dd47a7e3e3fc9e3d22c530d2ad6d1a4ef75d2ab Mon Sep 17 00:00:00 2001 From: Chinmay Pandhare Date: Tue, 14 Mar 2017 14:27:36 +0530 Subject: [PATCH] Added usage notes, changed a variable name. --- dist/image-sequencer.js | 20 ++++++++++++++++---- src/modules/Crop.js | 20 ++++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/dist/image-sequencer.js b/dist/image-sequencer.js index 181612bf..a879db02 100644 --- a/dist/image-sequencer.js +++ b/dist/image-sequencer.js @@ -184310,6 +184310,18 @@ module.exports = function UserInterface(options) { },{}],1040:[function(require,module,exports){ /* * Image Cropping module + * Usage: + * Expected Inputs: + * options.x : x-coordinate of image where the modules starts cropping | default : 0 + * options.y : y-coordinate of image where the modules starts cropping | default : 0 + * options.w : width of the resulting cropped image | default : 50% of input image width + * options.h : height of the resulting cropped image | default : 50% of input image height + * Output: + * The cropped image, which is essentially a rectangle bounded by the lines: + * x = options.x + * x = options.x + options.w + * y = options.y + * y = options.y + options.h */ module.exports = function Crop(options){ @@ -184324,10 +184336,10 @@ module.exports = function UserInterface(options) { getPixels(image.src,function(err,pixels){ var newdata = []; - var ox = options.cropX || 0; //Where to begin the crop on X axis - var oy = options.cropY || 0; //Where to begin the crop on Y axis - var w = options.cropL || Math.floor(0.5*pixels.shape[0]); //Length of crop - var h = options.cropH || Math.floor(0.5*pixels.shape[1]); //Height of crop + var ox = options.x || 0; + var oy = options.y || 0; + var w = options.w || Math.floor(0.5*pixels.shape[0]); + var h = options.h || Math.floor(0.5*pixels.shape[1]); var iw = pixels.shape[0]; //Width of Original Image newarray = new Uint8Array(4*w*h); for (var n = oy; n < oy + h; n++) { diff --git a/src/modules/Crop.js b/src/modules/Crop.js index bde46030..c98dc63e 100644 --- a/src/modules/Crop.js +++ b/src/modules/Crop.js @@ -1,5 +1,17 @@ /* * Image Cropping module + * Usage: + * Expected Inputs: + * options.x : x-coordinate of image where the modules starts cropping | default : 0 + * options.y : y-coordinate of image where the modules starts cropping | default : 0 + * options.w : width of the resulting cropped image | default : 50% of input image width + * options.h : height of the resulting cropped image | default : 50% of input image height + * Output: + * The cropped image, which is essentially a rectangle bounded by the lines: + * x = options.x + * x = options.x + options.w + * y = options.y + * y = options.y + options.h */ module.exports = function Crop(options){ @@ -14,10 +26,10 @@ getPixels(image.src,function(err,pixels){ var newdata = []; - var ox = options.x || 0; //Where to begin the crop on X axis - var oy = options.y || 0; //Where to begin the crop on Y axis - var w = options.l || Math.floor(0.5*pixels.shape[0]); //Length of crop - var h = options.h || Math.floor(0.5*pixels.shape[1]); //Height of crop + var ox = options.x || 0; + var oy = options.y || 0; + var w = options.w || Math.floor(0.5*pixels.shape[0]); + var h = options.h || Math.floor(0.5*pixels.shape[1]); var iw = pixels.shape[0]; //Width of Original Image newarray = new Uint8Array(4*w*h); for (var n = oy; n < oy + h; n++) {