【发布时间】:2015-09-09 19:16:39
【问题描述】:
我试过这段代码, 将一张图片粘贴到另一张图片上
from PIL import Image
img=Image.open("cat.jpg")
img2=Image.open("cat2.jpg")
area=(10,50,10,20)
img.paste(img2,area)
img.show()
但我得到一个错误
Traceback (most recent call last):
File "C:/Users/****/PycharmProjects/untitled2/s.py", line 6, in <module>
img.paste(img2,area)
File "C:\Python34\lib\site-packages\PIL\Image.py", line 1361, in paste
self.im.paste(im, box)
ValueError: images do not match
为什么?
【问题讨论】: