April 2018
Beginner
340 pages
7h 54m
English
In order to use PIL, we will first need to install it. The version which I will be using is available on pip and can be installed with the following command:
pip install pillow
PIL provides multiple ways of resizing an image. Two possible methods we could use in our application are resize and thumbnail.
The resize method will alter an image to be the exact size provided to the method (as a two-tuple of width and height). On the other hand, the thumbnail method will preserve the aspect ratio of an image, preventing skew, resizing the larger dimension of the image to the provided maximum size, and keeping the smaller dimension at the same ratio.