抠图后更新为保存为png格式,处理速度更快
This commit is contained in:
parent
cc0198c9b0
commit
530e7c8961
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user