In this article, we will learn to crop an image using pillow library. Cropping an image means to select a rectangular region inside an image and removing everything outside the rectangle. To crop an image we make use of
crop() method on image objects.
Syntax : IMG.crop(box_tuple)
Image_path- Location of the image
IMG- Image to crop
box_tuple- [left, up, right, bottom] of the image to crop
Returns : An Image object which represents the cropped image.
Input Image :
Input Image :
- Python PIL | Image.crop() method
- Python | Working with the Image Data Type in pillow
- Python | Copy and Paste Images onto other Image using Pillow
- Getting started with Scikit-image: image processing in Python
- Converting an image to ASCII image in Python
- Python PIL | Image.tell()
- Image Captioning using Python
- Python PIL | Image.getdata()
- Python PIL | Image.histogram()
- Python PIL | Image.new() method
- Python PIL | Image.convert() Method
- Image Registration using OpenCV | Python
- Image Steganography using OpenCV in Python
- Python PIL | Image.merge() method
- Python PIL | Image.frombuffer() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet