mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 12:55:38 +00:00
getstickers 修复转换 png 时锯齿过于严重的问题。
This commit is contained in:
parent
35a27cd07b
commit
e2e781cb85
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user