python crop images code example
Example 1: pil crop image
im = Image.open('image.jpg')
im = im.crop((left, top, right, bottom)) # coordinates of the crop
Example 2: crop image python
import cv2
img = cv2.imread("lenna.png")
crop_img = img[y:y+h, x:x+w]
cv2.imshow("cropped", crop_img)
cv2.waitKey(0)