1
2
3
4
5
6
7
8
9
pip install -i https://mirrors.aliyun.com/pypi/simple/ pillow

from PIL import Image
# 打开PNG图片
img = Image.open("image.png")
# 转换为RGB模式,去除Alpha通道
rgb_img = img.convert("RGB")
# 保存新的图片
rgb_img.save("image_no_alpha.png")