From aababfa10094321c5f06b4cfdd28b6ef3a252846 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Wed, 26 Jul 2023 12:20:17 -0700 Subject: test exif --- test.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test.py (limited to 'test.py') diff --git a/test.py b/test.py new file mode 100644 index 0000000..ce1a747 --- /dev/null +++ b/test.py @@ -0,0 +1,22 @@ +from PIL import Image, ExifTags +from PIL.ExifTags import TAGS +from iptcinfo3 import IPTCInfo +import exiftool +import io + +im = Image.open("2023-03-10 17-49-50-00-IMG_8077.jpg") + +img_byte_arr = io.BytesIO() +im.save(img_byte_arr, format='webp') +img_byte_arr.seek(0) +# img_byte_arr = img_byte_arr.getvalue() + +with exiftool.ExifToolHelper() as et: + metadata = et.get_metadata([img_byte_arr.getvalue()], raw_bytes=True) + for d in metadata: + # print("{:20.20} {:20.20}".format(d["SourceFile"], + # d["EXIF:DateTimeOriginal"])) + iso = d["EXIF:ISO"] + f = d["EXIF:FNumber"] + exp = d["EXIF:ExposureTime"] + print(f"{iso} {f} {exp}") \ No newline at end of file -- cgit v1.2.3