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 | Copy and Paste Images onto other Image using Pillow
- Python | Working with the Image Data Type in 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.histogram()
- Python PIL | Image.getdata()
- Python PIL | Image.new() method
- Python | Add image widget in Kivy
- Python PIL | Image.split() method
- Python | Add image on a Tkinter button
- Image Pyramid using OpenCV | Python
- Python PIL | Image.transform() 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 firstname.lastname@example.org. 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