我想寫一個python函數來將圖片的右半部分鏡像到左半邊。到目前爲止,我有這個代碼,但它的工作方式相反(它反映從L到R)我知道它必須是一些簡單的更改,但現在我似乎有一個塊。任何幫助讚賞。從R到L垂直鏡像圖像的Python函數
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)
謝謝,我知道這很簡單 – user1729377