From 3381c6e1659a7ce2b4cd1910a90c7f86c4490708 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 29 Mar 2024 20:39:53 +0100 Subject: [PATCH] Downscale image before uploading --- showbits-thermal-printer/static/photo.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/showbits-thermal-printer/static/photo.html b/showbits-thermal-printer/static/photo.html index da08994..1e29d03 100644 --- a/showbits-thermal-printer/static/photo.html +++ b/showbits-thermal-printer/static/photo.html @@ -127,8 +127,9 @@ button.addEventListener("click", () => { const canvas = document.createElement("canvas"); - canvas.width = video.videoWidth; - canvas.height = video.videoHeight; + const scale = 384 / video.videoWidth; + canvas.width = video.videoWidth * scale; + canvas.height = video.videoHeight * scale; canvas .getContext("2d") .drawImage(video, 0, 0, canvas.width, canvas.height);