From 52c411df8a74ca5ad5011feb4e7f50ea2587cfb5 Mon Sep 17 00:00:00 2001 From: akshatdalton Date: Sat, 3 Oct 2020 00:10:17 +0000 Subject: [PATCH] emoji: Add padding around the gif on GIF emoji upload. Replaced ImageOps.fit by ImageOps.pad, in zerver/lib/upload.py, which returns a sized and padded version of the image, expanded to fill the requested aspect ratio and size. Fixes part of #16370. --- zerver/lib/upload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zerver/lib/upload.py b/zerver/lib/upload.py index 9ff537eef1..f7aad3114c 100644 --- a/zerver/lib/upload.py +++ b/zerver/lib/upload.py @@ -159,7 +159,7 @@ def resize_gif(im: GifImageFile, size: int=DEFAULT_EMOJI_SIZE) -> bytes: im.seek(frame_num) new_frame = Image.new("RGBA", im.size) new_frame.paste(im, (0, 0), im.convert("RGBA")) - new_frame = ImageOps.fit(new_frame, (size, size), Image.ANTIALIAS) + new_frame = ImageOps.pad(new_frame, (size, size), Image.ANTIALIAS) frames.append(new_frame) duration_info.append(im.info['duration']) out = io.BytesIO()