Python 3.13 read information in photos
In photos there information saved, that it is called exif. Of course you can click on every photo and read this information. A little bit easier it would be with a script in Python.
You have to install the module: pillow.
pip3 install pillow
or to check it whether you already installed it
pip3 list | grep pillow
Here is the script:
from PIL import Image, ExifTags
img = Image.open("img.jpg")
img_exif = img.getexif()
print(type(img_exif))
# <class 'PIL.Image.Exif'>
if img_exif is None:
print('Sorry, image has no exif data.')
else:
for key, val in img_exif.items():
if key in ExifTags.TAGS:
print(f'{ExifTags.TAGS[key]}:{val}')
else:
print(f'{key}:{val}')
The output looks like this:
ResolutionUnit:2
ExifOffset:214
Make:Apple
Model:iPhone XR
Software:15.5
Orientation:1
DateTime:2022:06:30 06:59:46
YCbCrPositioning:1
XResolution:72.0
YResolution:72.0
HostComputer:iPhone XR