From be7840074fd54450a6230ebb392e2e09f0bd381b Mon Sep 17 00:00:00 2001 From: Paul Friederichsen Date: Wed, 2 Aug 2023 08:29:18 -0500 Subject: [PATCH] Fix EXIF handling for tiff, heif, heic, and avif files --- hydrus/core/HydrusImageHandling.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hydrus/core/HydrusImageHandling.py b/hydrus/core/HydrusImageHandling.py index 265b53ae..fbfdd284 100644 --- a/hydrus/core/HydrusImageHandling.py +++ b/hydrus/core/HydrusImageHandling.py @@ -535,11 +535,11 @@ def GenerateThumbnailBytesPIL( pil_image: PILImage.Image ) -> bytes: def GetEXIFDict( pil_image: PILImage.Image ) -> typing.Optional[ dict ]: - if pil_image.format in ( 'JPEG', 'TIFF', 'PNG', 'WEBP' ) and hasattr( pil_image, '_getexif' ): + if pil_image.format in ( 'JPEG', 'TIFF', 'PNG', 'WEBP', 'HEIF', 'AVIF' ): try: - exif_dict = pil_image._getexif() + exif_dict = pil_image.getexif()._get_merged_dict() if len( exif_dict ) > 0: