我需要水平翻转图片,而不使用反向功能,我以为我做对了,但我得到的错误是
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
Flip("bm.gif","bm.ppm")
File "C:\Users\....ImageProcessingSKLT.py", line 133, in Flip
pic1 = graphics.getPixel(x,y)
AttributeError: 'module' object has no attribute 'getPixel'
我的代码是
def Flip(image1, image2):
img = graphics.Image(graphics.Point(0, 0), image1)
X = img.getWidth()
Y = img.getHeight()
for y in range(Y//2):
for x in range(X):
pic1 = graphics.getPixel(x,y)
pic2 = graphics.setPixel(X-x,y)
temp = graphics.getColor(pic1)
graphics.setColor(pic1,getColor(pic2))
graphics.setColor(pic2,temp)
image2 = pic2
return image2
错误是什么意思?我该如何解决?