サンプルコード 写真から撮影時刻を取得し、その時刻を写真に書き込んで保存する。写真から撮影時刻を取得するとき、PIL モジュールの機能を利用する。 import PIL from PIL import Image from PIL import ExifTags import cv2 as cv def get_exif(image_path): captured_datetime = None with Image.open(image_path) as imgfh: try: exif = imgfh._getexif() for attr, val in exif.items(): tag = ExifTags.TAGS.get(attr, attr) if tag == 'DateTimeOriginal': captured_datetime = val except Attri