From 30974eb85f0879531d4c70d828de117ee5f144fb Mon Sep 17 00:00:00 2001 From: Quentin Roussel Date: Mon, 14 Oct 2024 18:09:04 +0800 Subject: [PATCH] improved image by making overlay transparent, fix #3 --- video.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/video.mjs b/video.mjs index 4278f5c..648948d 100644 --- a/video.mjs +++ b/video.mjs @@ -6,14 +6,17 @@ async function overlayImage(time_string) { let ctx = createCanvas(853, 479).getContext('2d'); let bg = await loadImage('bg.png') + ctx.globalAlpha = 1; ctx.drawImage(bg, 0, 0, 853, 479) let overlay = await loadImage('images/raw/' + time_string + '.png') + ctx.globalAlpha = 0.6; ctx.drawImage(overlay, 0, 0, 853, 479) let text = time_string.substring(8, 10) + ':' + time_string.substring(10, 12); ctx.font = 'bold 70px sans-serif'; ctx.fillStyle = 'rgba(0,0,0,0.7)'; + ctx.globalAlpha = 0.9; ctx.fillText(text, 853 - 250, 479 - 40); return ctx.canvas.toBuffer("image/png");