Skip to Content
Tkinter GUI Programming by Example
book

Tkinter GUI Programming by Example

by David Love
April 2018
Beginner content levelBeginner
340 pages
7h 54m
English
Packt Publishing
Content preview from Tkinter GUI Programming by Example

Manipulating images with PIL

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. 

For my implementation of this application, I will be using the thumbnail ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Bhaskar Chaudhary

Publisher Resources

ISBN: 9781788627481Supplemental Content