From 6cd3e84accc567c52bae509e5dd91481fa074a91 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 12 Apr 2024 14:21:07 -0400 Subject: [PATCH] Make emoji cleaner --- commands/edit-face/emoji-face.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/edit-face/emoji-face.js b/commands/edit-face/emoji-face.js index e4a7db47..906476ae 100644 --- a/commands/edit-face/emoji-face.js +++ b/commands/edit-face/emoji-face.js @@ -40,10 +40,6 @@ module.exports = class EmojiFaceCommand extends Command { } const emojiData = await request.get(emojiURL); const emojiImg = await loadImage(emojiData.body); - if (emojiURL.endsWith('svg')) { - emojiImg.width *= 4; - emojiImg.height *= 4; - } const imgData = await request.get(image); const faces = await this.client.detectFaces(imgData.body); if (!faces) return msg.reply('There are no faces in this image.'); @@ -55,6 +51,10 @@ module.exports = class EmojiFaceCommand extends Command { for (const face of faces) { const ratio = face.box.width / emojiImg.width; const height = emojiImg.height * ratio; + if (emojiURL.endsWith('svg')) { + emojiImg.width = face.box.width * 1.4; + emojiImg.height = height * 1.4; + } ctx.drawImage( emojiImg, face.box.xMin - (face.box.width * 0.2),