python
pip install Pillow
python
from PIL import Image
image = Image.open("image.jpg")
python
left = 100
upper = 100
right = 300
lower = 300
cropped_image = image.crop((left, upper, right, lower))
python
cropped_image.save("cropped_image.jpg")
python
from PIL import Image
def crop_image(image_path, left, upper, right, lower, output_path):
image = Image.open(image_path)
cropped_image = image.crop((left, upper, right, lower))
cropped_image.save(output_path)
crop_image("image.jpg", 100, 100, 300, 300, "cropped_image.jpg")