我有这个任务:编写一个在Python Image
模块中执行水平镜像的函数。我有点做了代码(不完整),但我仍然有一个错误:
TypeError:unorderable类型:Pixel()< INT()
非常感谢帮助:D
for i in range(0,img.getHeight()):
for j in range(0,int(img.getWidth()/2)):
old_pixel = img.getPixel(i, j)
a = old_pixel.getRed()
b = old_pixel.getGreen()
c = old_pixel.getBlue()
new_pixel = image.Pixel(a, b, c)
new_image.setPixel(new_pixel,img.getWidth()-1-i, j)