close

旋轉圖片寫法:

from PIL import Image

img = Image.open('test.jpg')

img = img.rotate(-90, expand=True) # 角度範圍: -360~360 (-表示逆時針旋轉)

img.save('result.jpg')

 

裁切圖片:

from PIL import Image

img = Image.open('test.jpg')

cropimg = img.crop((0, 0, 200, 200)) # ((x1, y1, x2, y2))

cropimg.save('cropresult.jpg')

arrow
arrow

    楓綺 發表在 痞客邦 留言(0) 人氣()