0%

使用Pillow库裁切图片

1
from PIL import Image
2
3
raw_image = Image.open(path)
4
area = (left, top, left + width, top + height) # 给定左上角坐标及右下角坐标
5
image = raw_image.crop(area)
6
image.save(new_path)
7
image.show()