Skip to content

Commit

Permalink
Merge pull request #169 from crimsobot/filesize-increase
Browse files Browse the repository at this point in the history
Increased file size limit
  • Loading branch information
h-anjru authored Jul 26, 2024
2 parents 1e65eb6 + cf97abf commit 7b35005
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 7b35005

Please sign in to comment.