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 #分隔 6 r1,g1,b1 = img1.split() 7 r2,g2,b2 = img2.split() 8 temp=[r1,g2,b1] 9 img = Image.merge('RGB',temp) 10 img.show()