Skip to Content
Mastering Python for Networking and Security
book

Mastering Python for Networking and Security

by José Manuel Ortega
September 2018
Intermediate to advanced
426 pages
10h 46m
English
Packt Publishing
Content preview from Mastering Python for Networking and Security

Getting the EXIF data from an image

First, we imported the PIL image and PIL TAGS modules. PIL is an image-processing module in Python. It supports many file formats and has a powerful image-processing capability. Then we iterate through the results and print the values. There are many other modules that support EXIF data extraction, such as ExifRead. In this example, to acquire the EXIF data, we can use the _getexif() method.

You can find the following code in the get_exif_tags.py file in the exiftags folder:

from PIL import Imagefrom PIL.ExifTags import TAGSfor (i,j) in Image.open('images/image.jpg')._getexif().items():    print('%s = %s' % (TAGS.get(i), j))
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

Mastering Python for Networking and Security - Second Edition

Mastering Python for Networking and Security - Second Edition

José Manuel Ortega
Python for Cybersecurity

Python for Cybersecurity

Howard E. Poston, III

Publisher Resources

ISBN: 9781788992510Supplemental Content