我正在玩 PIL 并遇到了这个问题,我看不出我在文档中哪里出错了。这是我的简单代码
from PIL import Image
from PIL.ImageChops import difference
imageA = Image.open("image1.png")
imageB = Image.open("image2.png")
if imageA.size == imageB.size:
diff = difference(imageA, imageB)
diff.save("test.png")
这给了我错误
Traceback (most recent call last):
File "C:\[XXX]\box-test.py", line 8, in <module>
diff = difference(imageA, imageB)
File "C:\Python32\lib\site-packages\PIL\ImageChops.py", line 123, in difference
return image1._new(image1.im.chop_difference(image2.im))
ValueError: images do not match
任何帮助,将不胜感激