我正在尝试编写一个 python 函数来将图片的右半部分镜像到左半部分。到目前为止,我有这段代码,但它以相反的方式工作(它从 L 镜像到 R)我知道它必须是一些简单的更改,但我现在似乎有一个障碍。任何帮助表示赞赏。
def mirrorVertical(source):
  mirrorPoint = getWidth(source) / 2
  width = getWidth(source)
  for y in range(0,getHeight(source)):
    for x in range(0,mirrorPoint):
      leftPixel = getPixel(source,x,y)
      rightPixel = getPixel(source,width - x - 1,y)
      color = getColor(leftPixel)
      setColor(rightPixel,color)