exif
This commit is contained in:
29
dzien_02/d_05_exif.py
Normal file
29
dzien_02/d_05_exif.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
from exif import Image
|
||||||
|
# otwarcie pliku
|
||||||
|
def fn_file(file_name):
|
||||||
|
try:
|
||||||
|
with open(file_name, mode="rb") as file:
|
||||||
|
img = Image(file)
|
||||||
|
return img
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
# sprawdzenie danych exif
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
print(fn_file("images/IMG_123311x.jpg"))
|
||||||
|
print(fn_file("images/IMG_1233.jpg"))
|
||||||
|
print(fn_file("to-do.md"))
|
||||||
Reference in New Issue
Block a user