diff --git a/dist/utils/qrCodeTemplateUtils.js b/dist/utils/qrCodeTemplateUtils.js index 5c10a713ee5defea367291b23fbad6c51c4d15c7..b0fc8bd6b5d8bdc4e6b8c71bcdc8c3280f5f28f1 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 fc6eaeb77cfd7d74ed6f2e7cc8787ce07d0db0bf..88007ae96b38f92f6f578e4fd29775462579035b 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;