Set ratio to minimum 50%
This commit is contained in:
parent
6db0132b07
commit
43d409953c
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue