diff --git a/files/helpers/media.py b/files/helpers/media.py index aa2989d0a..cf2347f36 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -140,7 +140,10 @@ def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[in try: with Image.open(filename) as i: - params = ["magick", filename, "-coalesce", "-quality", "88", "-strip", "-auto-orient"] + params = ["magick"] + if resize == 99: params.append(f"{filename}[0]") + else: params.append(filename) + params.extend(["-coalesce", "-quality", "88", "-strip", "-auto-orient"]) if trim and len(list(Iterator(i))) == 1: params.append("-trim") if resize and i.width > resize: diff --git a/files/routes/posts.py b/files/routes/posts.py index aeca01af4..919d9275b 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -470,7 +470,7 @@ def thumbnail_thread(pid:int, vid:int): file.write(chunk) v = db.get(User, vid) - url = process_image(name, v, resize=100, uploader_id=post.author_id, db=db) + url = process_image(name, v, resize=99, uploader_id=post.author_id, db=db) if url: post.thumburl = url db.add(post) @@ -748,7 +748,7 @@ def submit_post(v:User, sub=None): name2 = name.replace('.webp', 'r.webp') copyfile(name, name2) - post.thumburl = process_image(name2, v, resize=100) + post.thumburl = process_image(name2, v, resize=99) elif file.content_type.startswith('video/'): post.url = process_video(file, v) name = f'/images/{time.time()}'.replace('.','') + '.webp'