Change to pyexiv2
This commit is contained in:
parent
33546d8952
commit
b0e4c6501e
1 changed files with 6 additions and 8 deletions
|
@ -13,8 +13,7 @@ import click
|
||||||
import click_config_file
|
import click_config_file
|
||||||
from logging.handlers import SysLogHandler
|
from logging.handlers import SysLogHandler
|
||||||
import face_recognition
|
import face_recognition
|
||||||
import exif
|
import pyexiv2
|
||||||
from iptcinfo3 import IPTCInfo
|
|
||||||
import PIL
|
import PIL
|
||||||
|
|
||||||
class CustomFormatter(logging.Formatter):
|
class CustomFormatter(logging.Formatter):
|
||||||
|
@ -70,13 +69,12 @@ class image_classifier:
|
||||||
if people:
|
if people:
|
||||||
self._log.debug(f"Found {len(people)} known people in the image.")
|
self._log.debug(f"Found {len(people)} known people in the image.")
|
||||||
self._log.debug(json.dumps(people, indent=2))
|
self._log.debug(json.dumps(people, indent=2))
|
||||||
self.iptc_info = IPTCInfo(file, force=True)
|
self.metadata = pyexiv2.ImageMetadata(file)
|
||||||
print(f"IPTC info: {json.dumps(self.iptc_info['keywords'], indent=2)}")
|
self.metadata.read()
|
||||||
with open(file, 'rb') as image_file:
|
print(f"IPTC keys: {self.metadata.iptc_keys}")
|
||||||
exif_info = exif.Image(image_file)
|
print(f"EXIF keys: {self.metadata.exif_keys}")
|
||||||
print(f"EXIF info: {exif_info.get_all()}")
|
print(f"XMP keys: {self.metadata.xmp_keys}")
|
||||||
self.append_people(people)
|
self.append_people(people)
|
||||||
self.iptc_info.save()
|
|
||||||
self._log.debug(f"Updated file '{file}'.")
|
self._log.debug(f"Updated file '{file}'.")
|
||||||
# get date
|
# get date
|
||||||
self._log.debug(f"File time stamp: {self.iptc_info['Image timestamp']} (type: {type(self.iptc_info['Image timestamp'])})")
|
self._log.debug(f"File time stamp: {self.iptc_info['Image timestamp']} (type: {type(self.iptc_info['Image timestamp'])})")
|
||||||
|
|
Loading…
Reference in a new issue