I am trying to write a python function to mirror the right half of a picture to the left half. So far I have this code but it works in the opposite way (it mirrors from L to R) I know it must be a few simple changes, but I just seem to have a block now. Any help appreciated.
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)
1 Answer