PIL:
from PIL import Image
img = Image.open('test.jpg')
img.crop(50,60,170,150) # (left, upper, right, lower)
img.save('img_cro.jpg')
opencv:
import cv2
img = cv2.imread('test.jpg')
img_crop = img[60:150, 50:170] # The cutting coordinate is [y0:y1, x0:x1]
cv2.imwrite('img_crop.jpg')