From 4bd5e6cbbfaa239f0e1931f4d8f21b214f96be29 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 24 Mar 2024 14:16:47 -0400 Subject: [PATCH] Consistent box size --- commands/analyze/faces.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/analyze/faces.js b/commands/analyze/faces.js index 574560bf..f377616a 100644 --- a/commands/analyze/faces.js +++ b/commands/analyze/faces.js @@ -34,11 +34,12 @@ module.exports = class FacesCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(base, 0, 0); for (const face of faces) { + const lineSize = base.width / 70; ctx.fillStyle = 'blue'; - ctx.fillRect(face.box.xMin, face.box.yMin, 10, face.box.height); - ctx.fillRect(face.box.xMin, face.box.yMin, face.box.width, 10); - ctx.fillRect(face.box.xMin, face.box.yMax, face.box.width + 10, 10); - ctx.fillRect(face.box.xMax, face.box.yMin, 10, face.box.height); + ctx.fillRect(face.box.xMin, face.box.yMin, lineSize, face.box.height); + ctx.fillRect(face.box.xMin, face.box.yMin, face.box.width, lineSize); + ctx.fillRect(face.box.xMin, face.box.yMax, face.box.width + lineSize, lineSize); + ctx.fillRect(face.box.xMax, face.box.yMin, lineSize, face.box.height); } return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'faces.png' }] }); }