I'm trying to get all metadata tags from an image using the Pillow library but I get only 5 tags here :
ExifOffset :140
Make :HUAWEI
Model :VOG-L29
Software :Adobe Lightroom 5.0 (Android)
DateTime :2019:12:10 11:40:30
This is my code :
from PIL import Image
from PIL.ExifTags import TAGS
file = 'IMG_20191210_114027.jpg'
img = Image.open(file)
img_exif = img.getexif()
for tag_id in img_exif:
tag=TAGS.get(tag_id,tag_id)
data=img_exif.get(tag_id)
if isinstance(data,bytes):
data=data.decode()
print(f"{tag:20}:{data}")
and this is the pic I was using IMAGE
If we check this WEBSITE we get more tags like:
Make HUAWEI
Model VOG-L29
Software Adobe Lightroom 5.0 (Android)
ModifyDate 2019:12:10 11:40:30
ExposureTime 1/6900
FNumber 1.6
ExposureProgram Program AE
DateTimeOriginal 2019:12:10 11:40:30
ShutterSpeedValue 1/6900
ApertureValue 1.6
BrightnessValue 0
ExposureCompensation 0
MaxApertureValue 1.6
MeteringMode Multi-segment
LightSource Daylight
Flash No Flash
FocalLength 5.6 mm
SubSecTime 758
SubSecTimeOriginal 758
FocalLengthIn35mmFormat 55 mm
LensModel HUAWEI P30 Pro Rear Main Camera
How can I get all tags like on metapicz website? And how can I store each tag in different variable?
I ran your code exactly with the latest version of Pillow (Pillow==8.4.0) and got the same incomplete result. Then I downgraded to the version 7.0.0 and it worked!
pip install pillow==7.0.0 --upgrade