```
def pic_bg_alpha(img_path):
"""
图片背景透明
:param img_path: 图片地址
:return:
"""
from PIL import Image
img = Image.open(img_path)
rgba_img = img.convert('RGBA')
datas = rgba_img.getdata()
new_data = []
for item in datas:
if item[0] 255 and item[1] 255 and item[2] == 255:
new_data.append((255, 255, 255, 0))
else:
new_data.append(item)
rgba_img.putdata(new_data)
img_suffix = img_path.split('.')[-1]
new_path = img_path.replace("." + img_suffix, f"_alpha.{img_suffix}")
rgba_img.save(new_path)
return new_path
```