Cropping the image
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. PIL.Image.crop() method is used to crop a rectangular portion of any image.
Syntax: PIL.Image.crop(box = None)
Code:
Python3
from PIL import Image # Open image im = Image. open ( "nature.jpg" ) # Show actual Image im.show() # Show cropped Image im = im.crop(( 0 , 0 , 50 , 50 ) im.show() |
Output:
Python Pillow – Working with Images
In this article, we will see how to work with images using Pillow in Python. We will discuss basic operations like creating, saving, rotating images. So let’s get started discussing in detail but first, let’s see how to install pillow.
Installation
To install this package type the below command in the terminal.
pip install pillow