Home > Software design >  I can't get all metadata tags in Python with Pillow
I can't get all metadata tags in Python with Pillow

Time:10-26

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 Result image

  • Related