diff --git a/organize.py b/organize.py index 716be90..ce7f968 100644 --- a/organize.py +++ b/organize.py @@ -196,6 +196,22 @@ def _read_cr2_exif(path: Path) -> str | None: return raw_val.decode('utf-8') except Exception: pass + + # Fallback: PIL can read EXIF from CR2's embedded JPEG preview + try: + from PIL import Image + from PIL.ExifTags import TAGS + img = Image.open(path) + raw = img._getexif() + img.close() + if raw: + tag_map = {v: k for k, v in TAGS.items()} + for tag_name in ('DateTimeOriginal', 'DateTime'): + tag_code = tag_map.get(tag_name) + if tag_code and tag_code in raw: + return raw[tag_code] + except Exception: + pass return None