fix: remove early return in _read_cr2_exif when rawpy missing (was skipping piexif+PIL)
This commit is contained in:
1 parent
c0bd6acda6
commit
1bc1150fa8
1 file changed
+3
-13
+3
-13
@@ -176,18 +176,8 @@ def _read_other_exif_pil(path: Path) -> str | None:
|
||||
|
||||
|
||||
def _read_cr2_exif(path: Path) -> str | None:
|
||||
"""CR2 (Canon Raw): rawpy to read EXIF."""
|
||||
if not HAS_RAWPY:
|
||||
return None
|
||||
try:
|
||||
with rawpy.imread(str(path)) as raw:
|
||||
# rawpy doesn't expose parsed EXIF directly;
|
||||
# try the raw_image metadata
|
||||
pass
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Fallback: try piexif on CR2 (CR2 has a JPEG preview with EXIF)
|
||||
"""CR2/CR3 (Canon Raw): try piexif first, then PIL embedded JPEG."""
|
||||
# Tier 1: piexif on CR2 (TIFF-based EXIF)
|
||||
if HAS_PIEXIF:
|
||||
try:
|
||||
exif_dict = piexif.load(str(path))
|
||||
@@ -197,7 +187,7 @@ def _read_cr2_exif(path: Path) -> str | None:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Fallback: PIL can read EXIF from CR2's embedded JPEG preview
|
||||
# Tier 2: PIL can read EXIF from CR2's embedded JPEG preview
|
||||
try:
|
||||
from PIL import Image
|
||||
from PIL.ExifTags import TAGS
|
||||
|
||||
Reference in new issue
Block a user