From e96690d1d8ad95bf7b1fd43e6966348fdc5f48b1 Mon Sep 17 00:00:00 2001 From: Guimc Date: Tue, 18 Jul 2023 23:31:21 +0800 Subject: [PATCH] Updated --- list.json | 2 +- sticker_refactor/main.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/list.json b/list.json index 09d7de3..35aaa3e 100644 --- a/list.json +++ b/list.json @@ -2,7 +2,7 @@ "list": [ { "name": "sticker_refactor", - "version": "1.08", + "version": "1.09", "section": "chat", "maintainer": "Guimc", "size": "9.22kb", diff --git a/sticker_refactor/main.py b/sticker_refactor/main.py index 0752e35..aad2228 100644 --- a/sticker_refactor/main.py +++ b/sticker_refactor/main.py @@ -25,6 +25,7 @@ SUPPORTED_IMAGE_FILE = (".png", ".jpg", ".jpeg", ".bmp", ".cur", ".dcx", ".fli", ".flc", ".fpx", ".gbr", ".gd", ".ico", ".im", ".imt", ".psd") +IMAGE_IMPROVE = Image.LANCZOS class GeneralError(Exception): @@ -46,7 +47,9 @@ def set_emoji(e: str) -> None: def is_emoji(content: str) -> bool: - if content and (u"\U0001F600" <= content <= u"\U0001F64F" or u"\U0001F300" <= content <= u"\U0001F5FF" or u"\U0001F680" <= content <= u"\U0001F6FF" or u"\U0001F1E0" <= content <= u"\U0001F1FF" or content in ["⭐️", "❌"]): + if content and (u"\U0001F600" <= content <= u"\U0001F64F" or u"\U0001F300" <= content <= u"\U0001F5FF" or + u"\U0001F680" <= content <= u"\U0001F6FF" or u"\U0001F1E0" <= content <= u"\U0001F1FF" or + emoji.is_emoji(content) or content in ["⭐️", "❌"]): return True else: return False @@ -160,7 +163,7 @@ def convert_image(imgfile: str) -> str: else: scaling = 512 / height - img = img.resize((int(width * scaling), int(height * scaling))) + img = img.resize((int(width * scaling), int(height * scaling)), IMAGE_IMPROVE) img.save(imgfile + "_patched.png") return imgfile + "_patched.png"