diff options
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 | ||