getstickers 修复转换 png 时锯齿过于严重的问题。

This commit is contained in:
xtaodada 2021-07-01 16:09:25 +08:00
parent 35a27cd07b
commit e2e781cb85
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 3 additions and 7 deletions

View File

@ -146,11 +146,7 @@ def zipdir(path, ziph):
def convert_png(path): def convert_png(path):
im = Image.open(path) im = Image.open(path)
im.load() im = im.convert('RGBA')
alpha = im.split()[-1]
im = im.convert('RGB').convert('P', palette=Image.ADAPTIVE, colors=255)
mask = Image.eval(alpha, lambda a: 255 if a <=128 else 0)
im.paste(255, mask)
new_path = path.replace(".webp", ".png") new_path = path.replace(".webp", ".png")
im.save(new_path, transparency=255) im.save(new_path, 'PNG')
return new_path return new_path

View File

@ -532,7 +532,7 @@
}, },
{ {
"name": "getstickers", "name": "getstickers",
"version": "1.02", "version": "1.03",
"section": "chat", "section": "chat",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "5.4 kb", "size": "5.4 kb",