【发布时间】:2014-04-02 21:37:31
【问题描述】:
我正在尝试镜像图像。也就是说,例如,如果一个人面向左侧,当程序终止时,我希望该人现在面向右侧。
我了解镜像在 JES 中的工作原理,但我不确定如何在此处继续。
以下是我正在尝试的;请注意,image 是在另一个函数中声明的全局变量。
def flipPic(image):
width = getWidth(image)
height = getHeight(image)
for y in range(0, height):
for x in range(0, width):
left = getPixel(image, x, y)
right = getPixel(image, width-x-1, y)
color = getColor(left)
setColor(right, color)
show(image)
return image
【问题讨论】:
-
已经在这里提问和回答:stackoverflow.com/a/17129249/1715716