diff options
author | clarkzjw <[email protected]> | 2023-07-26 12:20:17 -0700 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-07-26 12:20:17 -0700 |
commit | aababfa10094321c5f06b4cfdd28b6ef3a252846 (patch) | |
tree | 448d5df8a555649ff517f344a5a1dcc30e3437ed /test.py | |
parent | 78d996f287ecc2c4ab8c4580f8d2ba0a1eed963e (diff) | |
download | photo-aababfa10094321c5f06b4cfdd28b6ef3a252846.tar.gz |
test exifexif
Diffstat (limited to 'test.py')
-rw-r--r-- | test.py | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ | |||
1 | from PIL import Image, ExifTags | ||
2 | from PIL.ExifTags import TAGS | ||
3 | from iptcinfo3 import IPTCInfo | ||
4 | import exiftool | ||
5 | import io | ||
6 | |||
7 | im = Image.open("2023-03-10 17-49-50-00-IMG_8077.jpg") | ||
8 | |||
9 | img_byte_arr = io.BytesIO() | ||
10 | im.save(img_byte_arr, format='webp') | ||
11 | img_byte_arr.seek(0) | ||
12 | # img_byte_arr = img_byte_arr.getvalue() | ||
13 | |||
14 | with exiftool.ExifToolHelper() as et: | ||
15 | metadata = et.get_metadata([img_byte_arr.getvalue()], raw_bytes=True) | ||
16 | for d in metadata: | ||
17 | # print("{:20.20} {:20.20}".format(d["SourceFile"], | ||
18 | # d["EXIF:DateTimeOriginal"])) | ||
19 | iso = d["EXIF:ISO"] | ||
20 | f = d["EXIF:FNumber"] | ||
21 | exp = d["EXIF:ExposureTime"] | ||
22 | print(f"{iso} {f} {exp}") \ No newline at end of file | ||