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')
文章標籤
全站熱搜
留言列表