Compare commits

...

3 Commits

Author SHA1 Message Date
Aevann1 1a4600bd95 imagemagick is really cringe 2022-12-07 10:42:23 +02:00
Aevann1 5d2dbee95e increase MAX_IMAGE_CONVERSION_TIMEOUT from 15 to 30 2022-12-07 10:30:11 +02:00
Aevann1 ab51e97e09 better error message 2022-12-07 10:28:01 +02:00
2 changed files with 3 additions and 4 deletions

View File

@ -471,7 +471,7 @@ MAX_IMAGE_AUDIO_SIZE_MB = 8
MAX_IMAGE_AUDIO_SIZE_MB_PATRON = 16
MAX_VIDEO_SIZE_MB = 32
MAX_VIDEO_SIZE_MB_PATRON = 64
MAX_IMAGE_CONVERSION_TIMEOUT = 15 # seconds
MAX_IMAGE_CONVERSION_TIMEOUT = 30 # seconds
ANTISPAM_BYPASS_IDS = set()

View File

@ -143,8 +143,7 @@ def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[in
try:
with Image.open(filename) as i:
params = ["magick", filename]
if i.format.lower() != 'webp':
params.extend(["-coalesce", "-quality", "88", "-define", "webp:method=5"])
params.extend(["-coalesce", "-quality", "88"])
if trim and len(list(Iterator(i))) == 1:
params.append("-trim")
if resize and i.width > resize:
@ -165,7 +164,7 @@ def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[in
except subprocess.TimeoutExpired:
if has_request:
abort(413, ("An uploaded image took too long to convert to WEBP. "
"Consider uploading elsewhere."))
"Please convert it to WEBP elsewhere then upload it again."))
return None
if resize: