import cv2
img = cv2.imread(img_path) #img_path为图片所在路径
crop_img = img[y0:y1,x0:x1] #x0,y0为裁剪区域左上坐标;x1,y1为裁剪区域右下坐标
cv2.imwrite(save_path,crop_img) #save_path为保存路径
from PIL import Image
img = Image.open(img_path)
crop_img = img.crop((x0,y0,x1,y1))
crop_img.save(new_name) #new_name为图像新的名字