如何编写代码?我只想出这个:
def rotateImage90CW(image):
pic = FileImage(image)
oldw = pic.getWidth()
oldh = pic.getHeight()
newIm = EmptyImage(oldw,oldh)
for row in range (oldh):
for col in range(oldw):
oldPixel = pic.getPixel(col,row)
newIm.setPixel(oldw-row,col,oldPixel)
newIm.draw(myWin)
答案 0 :(得分:0)
如果您使用PIL /枕头:
from PIL import Image
im = Image.open(image)
im.rotate(90).show()
在您的示例中,oldw-row应为“row”