From 43d409953cdc94e2841838eff5b0f3e0f11a85ef Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sat, 26 Jun 2021 23:32:05 -0600 Subject: [PATCH] Set ratio to minimum 50% --- jarvis/cogs/image.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jarvis/cogs/image.py b/jarvis/cogs/image.py index e25f60c..6509022 100644 --- a/jarvis/cogs/image.py +++ b/jarvis/cogs/image.py @@ -65,12 +65,12 @@ class ImageCog(commands.Cog): await ctx.send("Image already meets target.") return - ratio = tgt_size / size - 0.02 + ratio = max(tgt_size / size - 0.02, 0.50) accuracy = 0.0 # TODO: Optimize to not run multiple times while len(file) > tgt_size or ( - len(file) < tgt_size and accuracy < 0.50 + len(file) <= tgt_size and accuracy < 0.50 ): old_file = file @@ -87,7 +87,7 @@ class ImageCog(commands.Cog): file = old_file ratio += 0.1 else: - ratio = tgt_size / len(file) - 0.02 + ratio = max(tgt_size / len(file) - 0.02, 0.50) bufio = BytesIO(file) accuracy = (len(file) / tgt_size) * 100