dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (image) {
                var _this = this;
                return new Promise(function (resolve, reject) {
                    _this.processing.emit(true);
                    setTimeout(function () {
                        /** @type {?} */
                        var src = cv.imread(image);
                        /** @type {?} */
                        var currentDimensions = {
                            width: src.size().width,
                            height: src.size().height
                        };
                        /** @type {?} */
                        var resizeDimensions = {
                            width: 0,
                            height: 0
                        };
                        if (currentDimensions.width > _this.options.maxImageDimensions.width) {
                            resizeDimensions.width = _this.options.maxImageDimensions.width;
                            resizeDimensions.height = _this.options.maxImageDimensions.width / currentDimensions.width * currentDimensions.height;
                            if (resizeDimensions.height > _this.options.maxImageDimensions.height) {
                                resizeDimensions.height = _this.options.maxImageDimensions.height;
                                resizeDimensions.width = _this.options.maxImageDimensions.height / currentDimensions.height * currentDimensions.width;
                            }
                            /** @type {?} */
                            var dsize = new cv.Size(Math.floor(resizeDimensions.width), Math.floor(resizeDimensions.height));
                            cv.resize(src, src, dsize, 0, 0, cv.INTER_AREA);
                            /** @type {?} */
                            var resizeResult = ( /** @type {?} */(document.createElement('canvas')));
                            cv.imshow(resizeResult, src);
                            src.delete();
                            _this.processing.emit(false);
                            resolve(resizeResult);
                        }
                        else {
                            _this.processing.emit(false);
                            resolve(image);
                        }
                    }, 30);
                });
            }
function (image) {
                var _this = this;
                return new Promise(function (resolve, reject) {
                    _this.processing.emit(true);
                    setTimeout(function () {
                        /** @type {?} */
                        var src = cv.imread(image);
                        /** @type {?} */
                        var currentDimensions = {
                            width: src.size().width,
                            height: src.size().height
                        };
                        /** @type {?} */
                        var resizeDimensions = {
                            width: 0,
                            height: 0
                        };
                        if (currentDimensions.width > _this.options.maxImageDimensions.width) {
                            resizeDimensions.width = _this.options.maxImageDimensions.width;
                            resizeDimensions.height = _this.options.maxImageDimensions.width / currentDimensions.width * currentDimensions.height;
                            if (resizeDimensions.height > _this.options.maxImageDimensions.height) {
                                resizeDimensions.height = _this.options.maxImageDimensions.height;
                                resizeDimensions.width = _this.options.maxImageDimensions.height / currentDimensions.height * currentDimensions.width;
                            }
                            /** @type {?} */
                            var dsize = new cv.Size(Math.floor(resizeDimensions.width), Math.floor(resizeDimensions.height));
                            cv.resize(src, src, dsize, 0, 0, cv.INTER_AREA);
                            /** @type {?} */
                            var resizeResult = ( /** @type {?} */(document.createElement('canvas')));
                            cv.imshow(resizeResult, src);
                            src.delete();
                            _this.processing.emit(false);
                            resolve(resizeResult);
                        }
                        else {
                            _this.processing.emit(false);
                            resolve(image);
                        }
                    }, 30);
                });
            }
function ( image ) { var _this = this ; return new Promise ( function ( resolve , reject ) { _this . processing . emit ( true ) ; setTimeout ( function ( ) { /** @type {?} */ var src = cv . imread ( image ) ; /** @type {?} */ var currentDimensions = { width : src . size ( ) . width , height : src . size ( ) . height } ; /** @type {?} */ var resizeDimensions = { width : 0 , height : 0 } ; if ( currentDimensions . width > _this . options . maxImageDimensions . width ) { resizeDimensions . width = _this . options . maxImageDimensions . width ; resizeDimensions . height = _this . options . maxImageDimensions . width / currentDimensions . width * currentDimensions . height ; if ( resizeDimensions . height > _this . options . maxImageDimensions . height ) { resizeDimensions . height = _this . options . maxImageDimensions . height ; resizeDimensions . width = _this . options . maxImageDimensions . height / currentDimensions . height * currentDimensions . width ; } /** @type {?} */ var dsize = new cv . Size ( Math . floor ( resizeDimensions . width ) , Math . floor ( resizeDimensions . height ) ) ; cv . resize ( src , src , dsize , 0 , 0 , cv . INTER_AREA ) ; /** @type {?} */ var resizeResult = ( /** @type {?} */ ( document . createElement ( 'canvas' ) ) ) ; cv . imshow ( resizeResult , src ) ; src . delete ( ) ; _this . processing . emit ( false ) ; resolve ( resizeResult ) ; } else { _this . processing . emit ( false ) ; resolve ( image ) ; } } , 30 ) ; } ) ; }
resize an image to fit constraints set in options.maxImageDimensions
@private
@param {?} image
@return {?}
resize an image to fit constraints set in options . maxImageDimensions