exif
This commit is contained in:
BIN
dzien_02/IMG_1233.jpg
Normal file
BIN
dzien_02/IMG_1233.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -10,20 +10,33 @@ def fn_file(file_name):
|
||||
return False
|
||||
|
||||
# sprawdzenie danych exif
|
||||
def file_ok(image):
|
||||
if image.has_exif:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
# wyciagniecie danych
|
||||
|
||||
def info(file_name):
|
||||
ret = f"Info: {file_name} - "
|
||||
try:
|
||||
with open(file_name, mode="rb") as file:
|
||||
img_bin = Image(file)
|
||||
dane = img_bin.get_all()
|
||||
ret += str(dane)
|
||||
except:
|
||||
ret += "Bład pliku"
|
||||
|
||||
def get_exif(image):
|
||||
ret = ""
|
||||
all_data = image.get_all()
|
||||
klucze = all_data.keys()
|
||||
if 'lens_model' in klucze:
|
||||
ret += f" Lens model: {all_data['lens_model']}"
|
||||
if "make" in klucze:
|
||||
ret += f" Make: {all_data['make']}"
|
||||
if "model" in klucze:
|
||||
ret += f" Model: {all_data['model']}"
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
print(fn_file("images/IMG_123311x.jpg"))
|
||||
print(fn_file("images/IMG_1233.jpg"))
|
||||
|
||||
ok = fn_file("IMG_1233.jpg")
|
||||
if ok:
|
||||
if file_ok(ok):
|
||||
print(get_exif(ok))
|
||||
|
||||
print(fn_file("to-do.md"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user