Skip to content

Commit

Permalink
Increased file size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
h-anjru committed Jul 26, 2024
1 parent 1e65eb6 commit cf97abf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crimsobot/data/img/rules.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
image:
max_filesize: 8000000
max_filesize: 25000000
msg_scrape_limit: 10
url_contains:
- .jpg
Expand Down
2 changes: 1 addition & 1 deletion crimsobot/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ async def process_image(ctx: Context, image: Optional[str], effect: str, arg: Op

# recursively resize image until it meets Discord filesize limit
img = Image.open(fp)
scale = 0.9 * IMAGE_RULES['max_filesize'] / n_bytes # 0.9x bias to help ensure it comes in under max size
scale = 0.95 * IMAGE_RULES['max_filesize'] / n_bytes # 0.95x bias to help ensure it comes in under max size

fp = await process_lower_level(img, 'resize', scale)
n_bytes = fp.getbuffer().nbytes
Expand Down

0 comments on commit cf97abf

Please sign in to comment.