From 03e7e6932a705a9ea530431d30a71ee064146d42 Mon Sep 17 00:00:00 2001 From: ColonelParrot <65585002+ColonelParrot@users.noreply.github.com> Date: Wed, 10 May 2023 15:37:30 -0400 Subject: [PATCH] extractPaper: remove callback, direct return --- src/jscanify-node.js | 6 +++--- src/jscanify.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/jscanify-node.js b/src/jscanify-node.js index 7dbb3de..f8bf050 100644 --- a/src/jscanify-node.js +++ b/src/jscanify-node.js @@ -1,4 +1,4 @@ -/*! jscanify v1.1.0 | (c) ColonelParrot and other contributors | MIT License */ +/*! jscanify v1.2.0 | (c) ColonelParrot and other contributors | MIT License */ const { Canvas, createCanvas, Image, ImageData } = require("canvas"); const { JSDOM } = require("jsdom"); @@ -143,7 +143,7 @@ class jscanify { * @param {*} onComplete callback with `HTMLCanvasElement` passed - the unwarped paper * @param {*} cornerPoints optional custom corner points, in case automatic corner points are incorrect */ - extractPaper(image, resultWidth, resultHeight, onComplete, cornerPoints) { + extractPaper(image, resultWidth, resultHeight, cornerPoints) { const canvas = createCanvas(); const img = cv.imread(image); const maxContour = this.findPaperContour(img); @@ -190,7 +190,7 @@ class jscanify { img.delete(); warpedDst.delete(); - onComplete(canvas); + return canvas; } /** diff --git a/src/jscanify.js b/src/jscanify.js index b2c0541..463369e 100644 --- a/src/jscanify.js +++ b/src/jscanify.js @@ -1,4 +1,4 @@ -/*! jscanify v1.1.0 | (c) ColonelParrot and other contributors | MIT License */ +/*! jscanify v1.2.0 | (c) ColonelParrot and other contributors | MIT License */ (function (global, factory) { typeof exports === "object" && typeof module !== "undefined" @@ -134,7 +134,7 @@ * @param {*} onComplete callback with `HTMLCanvasElement` passed - the unwarped paper * @param {*} cornerPoints optional custom corner points, in case automatic corner points are incorrect */ - extractPaper(image, resultWidth, resultHeight, onComplete, cornerPoints) { + extractPaper(image, resultWidth, resultHeight, cornerPoints) { const canvas = document.createElement("canvas"); const img = cv.imread(image); @@ -187,7 +187,7 @@ img.delete() warpedDst.delete() - onComplete(canvas) + return canvas; } /**