From 530e7c89613132a27a1428a363df7477424cf1fd Mon Sep 17 00:00:00 2001 From: jingrow Date: Mon, 15 Dec 2025 16:24:44 +0000 Subject: [PATCH] =?UTF-8?q?=E6=8A=A0=E5=9B=BE=E5=90=8E=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=B8=BA=E4=BF=9D=E5=AD=98=E4=B8=BApng=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E5=A4=84=E7=90=86=E9=80=9F=E5=BA=A6=E6=9B=B4=E5=BF=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/rmbg/service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/rmbg/service.py b/apps/rmbg/service.py index 387ee04..ef1431e 100644 --- a/apps/rmbg/service.py +++ b/apps/rmbg/service.py @@ -424,10 +424,10 @@ class RmbgService: def save_image_to_file(self, image): """保存图片到文件并返回URL""" - filename = f"rmbg_{uuid.uuid4().hex[:10]}.webp" + # 改为保存 PNG,使用标准压缩级别(Pillow 默认 compress_level=6) + filename = f"rmbg_{uuid.uuid4().hex[:10]}.png" file_path = os.path.join(self.save_dir, filename) - - image.save(file_path, format="WEBP", quality=85, method=6) + image.save(file_path, format="PNG") image_url = f"{self.download_url}/{filename}" return image_url