DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
def bubg(filepath, color_list): # 透明色用背景色补齐 # 输出修改后文件夹中包含的文件 im = Image.open(filepath) x, y = im.size # 使用蓝色色来填充背景(0,0,255) 黑色(0,0,0) p = Image.new('RGBA', im.size, color_list) p.paste(im, (0, 0, x, y), im) p.resize((62,62), Image.LANCZOS) p.save(filepath) fp = 'images\\fenge\gjqr-2.png' cl = (0,0,0) bubg(fp,cl)
提示:
E:\pgame\venv\Scripts\python.exe E:/pgame/图片工具/批量补背景色转统一大小.py
E:/pgame/图片工具/批量补背景色转统一大小.py:18: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
p.resize((62,62), Image