Book Image

Raspberry Pi cookbook for Python programmers

Book Image

Raspberry Pi cookbook for Python programmers

Overview of this book

Table of Contents (18 chapters)
Raspberry Pi Cookbook for Python Programmers
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Displaying photo information in an application


In this example, we shall create a utility class for handling photos that can be used by other applications (as a module) to access Photo metadata and display preview images easily.

Getting ready

The following script makes use of Python Image Library (PIL); a compatible version for Python 3 is Pillow.

Pillow has not been included in the Raspbian repository (used by apt-get); therefore, we will need to install Pillow using a Python Package Manager called PIP.

To install packages for Python 3, we will use the Python 3 version of PIP (this requires 50 MB of available space).

The following commands can be used to install PIP:

sudo apt-get update
sudo apt-get install python3-pip

Before you use PIP, ensure that you have installed libjpeg-dev to allow Pillow to handle JPEG files. You can do this using the following command:

sudo apt-get install libjpeg-dev

Now you can install Pillow using the following PIP command:

sudo pip-3.2 install pillow

PIP also...