来源:https://zhuanlan.zhihu.com/p/215777730
from PIL import Image
img = Image.open('01.jpg')
width, height = img.size
# 前两个坐标点是左上角坐标
# 后两个坐标点是右下角坐标
# width在前, height在后
box = (100, 100, 550, 350)
region = img.crop(box)
region.save('crop.jpg')
来源:https://zhuanlan.zhihu.com/p/215777730
from PIL import Image
img = Image.open('01.jpg')
width, height = img.size
# 前两个坐标点是左上角坐标
# 后两个坐标点是右下角坐标
# width在前, height在后
box = (100, 100, 550, 350)
region = img.crop(box)
region.save('crop.jpg')