-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_light_on_image.py
39 lines (32 loc) · 1.15 KB
/
test_light_on_image.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import tkinter as tk
from tkinter import filedialog
from PIL import Image
import exifread
def get_exif_data(image_path):
with open(image_path, 'rb') as image_file:
tags = exifread.process_file(image_file)
exposure_time = tags.get('EXIF ExposureTime', 'N/A')
iso_speed = tags.get('EXIF ISOSpeedRatings', 'N/A')
return exposure_time, iso_speed
def select_images():
root = tk.Tk()
root.withdraw() # Hide the main window
file_paths = filedialog.askopenfilenames(
title="Select Images",
filetypes=[("JPEG files", "*.jpg;*.jpeg")],
)
return list(file_paths)
def main():
image_data = []
file_paths = select_images()
for image_path in file_paths:
filename = os.path.basename(image_path)
exposure_time, iso_speed = get_exif_data(image_path)
image_data.append((filename, exposure_time, iso_speed))
return image_data
# Example usage
image_details = main()
# Print the results
for image_name, exposure_time, iso_speed in image_details:
print(f'{image_name} - Exposure Time: {exposure_time} - ISO Speed: {iso_speed}')