from PIL import Image
img = Image.open('Frame 0001.png')
img = img.convert("RGBA")
datas = img.getdata()
newData = []
for item in datas:
if item[0] == 255 and item[1] == 255 and item[2] == 255:
newData.append((255, 255, 255, 0))
else:
newData.append(item)
img.putdata(newData)
img.save("img2.png", "PNG")
答案 0 :(得分:1)
谷歌搜索了一下,发现了一个名为cv2的软件包。安装该软件包时遇到了困难,但我试图做的事情是可能的
import cv2
img1=cv2.imread('m1.jpg')
img2=cv2.imread('logo.jpg')
dst=cv2.addWeighted(img1,0.7,img2,0.3,0)
cv2.imshow('dst',dst)
cv2.waitKey(0)
cv2.destroyAllWindows()