How to do it...

To display photo information in an application, create the following photohandler.py script:

##!/usr/bin/python3 #photohandler.py from PIL import Image from PIL import ExifTags import datetime import os #set module values previewsize=240,240 defaultimagepreview="./preview.ppm" filedate_to_use="Exif DateTime" #Define expected inputs ARG_IMAGEFILE=1 ARG_LENGTH=2 class Photo: def __init__(self,filename): """Class constructor""" self.filename=filename self.filevalid=False self.exifvalid=False img=self.initImage() if self.filevalid==True: self.initExif(img) self.initDates() def initImage(self): """opens the image and confirms if valid, returns Image""" try: img=Image.open(self.filename) self.filevalid=True except IOError: print ...

Get Raspberry Pi 3 Cookbook for Python Programmers - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.