Python PIL: How to save cropped image?

需要取得圖片中的某一個區塊,想要剪裁圖片的範例如下:

from PIL import Image

imageObject = Image.open(saved_image_path)
box = (x_offset, Y_offset, width, height)
crop = imageObject.crop(box)
crop.save(saved_image_path, format)

資料來源:
https://stackoverflow.com/questions/6456479/python-pil-how-to-save-cropped-image

Python Pillow – Cropping an Image
https://www.tutorialspoint.com/python_pillow/python_pillow_cropping_an_image.htm

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *