How to get total size of photo in Pillow?

Viewed 54

I want to get total size of photo in MB but I get only ExifImageWidth and ExifImageHeight. How can I do this?

Code:

from PIL import Image
from PIL.ExifTags import TAGS

image = Image.open('images\DJI_0001.jpg')

exifdata = image.getexif()

for tag_id in exifdata:
    tag = TAGS.get(tag_id, tag_id)
    data = exifdata.get(tag_id)
    if isinstance(data, bytes):
        try:
            data = data.decode()
        except:
            continue
    print(f"{tag}: {data}")
0 Answers
Related