From a2a1120283134f11b80c90adbffa0069a7a7112e Mon Sep 17 00:00:00 2001 From: sovrgn <boyan.tsolov@vereign.com> Date: Thu, 30 Nov 2023 14:37:29 +0200 Subject: [PATCH] test 234 --- dist/utils/qrCodeTemplateUtils.js | 4 ++++ src/utils/qrCodeTemplateUtils.ts | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/dist/utils/qrCodeTemplateUtils.js b/dist/utils/qrCodeTemplateUtils.js index 5c10a71..b0fc8bd 100644 --- a/dist/utils/qrCodeTemplateUtils.js +++ b/dist/utils/qrCodeTemplateUtils.js @@ -224,11 +224,13 @@ const putQrCodeOnChromakeyTemplateNodeJS = (qrCodeImageBase64, templateImageBase throw new Error("NodeJS cannot load qr code image"); } const templateImage = yield loadImageNode(templateImageBase64, document); + console.log('==11==11111111====', templateImage.width); if (templateImage.width < placeholderWidth || templateImage.height < placeholderHeight) { throw new Error("Placeholder is bigger than image"); } const templateCanvas = document.createElement("canvas"); + console.log('===2222TEmplateCanvas===', templateCanvas.width); templateCanvas.width = templateImage.width; templateCanvas.height = templateImage.height; const templateCtx = templateCanvas.getContext("2d"); @@ -236,6 +238,7 @@ const putQrCodeOnChromakeyTemplateNodeJS = (qrCodeImageBase64, templateImageBase const templateImgData = templateCtx.getImageData(0, 0, templateCanvas.width, templateCanvas.height); const placeholderCoordinates = findChromakeyBoundaries(templateImage.width, templateImage.height, templateImgData, placeholderWidth, placeholderHeight); // -2 is for QR to slightly cover borders. To avoid green mask bulging out + console.log('====33333333====qrCodeImage===', qrCodeImage.width); const scaleX = ((qrCodeImage.width - 2) / placeholderWidth) * scale; const scaleY = ((qrCodeImage.height - 2) / placeholderHeight) * scale; qrCodeImage.width *= scale; @@ -243,6 +246,7 @@ const putQrCodeOnChromakeyTemplateNodeJS = (qrCodeImageBase64, templateImageBase const bannerCanvas = document.createElement("canvas"); const scaledTemplateW = Math.floor(templateImage.width * scaleX); const scaledTemplateH = Math.floor(templateImage.height * scaleY); + console.log('=====4444=====BannerCanvas==', bannerCanvas.width); bannerCanvas.width = scaledTemplateW; bannerCanvas.height = scaledTemplateH; const bannerCtx = bannerCanvas.getContext("2d"); diff --git a/src/utils/qrCodeTemplateUtils.ts b/src/utils/qrCodeTemplateUtils.ts index fc6eaeb..88007ae 100644 --- a/src/utils/qrCodeTemplateUtils.ts +++ b/src/utils/qrCodeTemplateUtils.ts @@ -288,6 +288,8 @@ const putQrCodeOnChromakeyTemplateNodeJS = async ( } const templateImage = await loadImageNode(templateImageBase64, document); + console.log("==11==11111111====", templateImage.width); + if ( templateImage.width < placeholderWidth || templateImage.height < placeholderHeight @@ -296,6 +298,9 @@ const putQrCodeOnChromakeyTemplateNodeJS = async ( } const templateCanvas = document.createElement("canvas"); + + console.log("===2222TEmplateCanvas===", templateCanvas.width); + templateCanvas.width = templateImage.width; templateCanvas.height = templateImage.height; @@ -323,6 +328,9 @@ const putQrCodeOnChromakeyTemplateNodeJS = async ( placeholderHeight ); // -2 is for QR to slightly cover borders. To avoid green mask bulging out + + console.log("====33333333====qrCodeImage===", qrCodeImage.width); + const scaleX = ((qrCodeImage.width - 2) / placeholderWidth) * scale; const scaleY = ((qrCodeImage.height - 2) / placeholderHeight) * scale; qrCodeImage.width *= scale; @@ -332,6 +340,8 @@ const putQrCodeOnChromakeyTemplateNodeJS = async ( const scaledTemplateW = Math.floor(templateImage.width * scaleX); const scaledTemplateH = Math.floor(templateImage.height * scaleY); + console.log("=====4444=====BannerCanvas==", bannerCanvas.width); + bannerCanvas.width = scaledTemplateW; bannerCanvas.height = scaledTemplateH; -- GitLab