Skip to content
Snippets Groups Projects
Commit a2a11202 authored by Boyan Tsolov's avatar Boyan Tsolov
Browse files

test 234

parent c93f9d39
No related branches found
No related tags found
1 merge request!91DRAFT: TEST (delete when done testing) upgrade yarn
Pipeline #68506 passed
......@@ -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");
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment