1 from PIL import Image 2 img1 = Image.open(r'C:Users87823Desktop ree.png') 3 img2 = Image.open(r'C:Users87823Desktopgold.png') 4 img2 = img2.resize(img1.size) #尺寸要相同 5 r,g,b = img1.split() # 分隔通道 6 Image.composite(img1,img2,b).show()
1 from PIL import Image 2 img1 = Image.open(r'C:Users87823Desktop ree.png') 3 img2 = Image.open(r'C:Users87823Desktopgold.png') 4 img2 = img2.resize(img1.size) #尺寸要相同 5 r,g,b = img1.split() # 分隔通道 6 Image.composite(img1,img2,b).show()