使用Pillow库裁切图片

1
2
3
4
5
6
7
from PIL import Image

raw_image = Image.open(path)
area = (left, top, left + width, top + height) # 给定左上角坐标及右下角坐标
image = raw_image.crop(area)
image.save(new_path)
image.show()