From 22466322d80f76fd12f37168a3021d61e3a1ed79 Mon Sep 17 00:00:00 2001 From: io Date: Sun, 11 Jul 2021 02:55:22 +0000 Subject: [PATCH] only resize in subprocess when necessary --- cogs/emote.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cogs/emote.py b/cogs/emote.py index 65112ea..4115f92 100644 --- a/cogs/emote.py +++ b/cogs/emote.py @@ -441,7 +441,8 @@ class Emotes(commands.Cog): return await validate(self.http.get(url)) async def create_emote_from_bytes(self, context, name, image_data: bytes, *, reason=None): - image_data = await utils.image.resize_in_subprocess(image_data) + if len(image_data) > 256 * 1024: + image_data = await utils.image.resize_in_subprocess(image_data) if reason is None: reason = 'Created by ' + utils.format_user(context.author) return await self.emote_client.create(guild=context.guild, name=name, image=image_data, reason=reason)