(53条消息) python使用PIL把透明背景图片转成白色背景_python全部底图改成白底图_Dxy1239310216的博客-CSDN博客
做个记录
from PIL import Image
imagePtah = r'E:\Python\test1.png'
img = Image.open(imagePtah)
if img.mode != 'RGBA':
img = img.convert('RGBA')
width = img.width
height = img.height
img2 = Image.new('RGB', size=(width, height), color=(255, 255, 255))
img2.paste(img, (0, 0), mask=img)
img2.show()