From 568a87f44a674276e6e55f9302cc9e44a0929f71 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Fri, 9 May 2025 22:04:15 -0500 Subject: get exif correctly --- texture.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/texture.py b/texture.py index cf37d6a..73b7a84 100644 --- a/texture.py +++ b/texture.py @@ -8,7 +8,7 @@ class ImageTexture: self.id = None img = Image.open(image_source) self.exif = exif or ImageTexture.get_exif(img) - img = ImageTexture.handle_orientation(img, exif) + img = ImageTexture.handle_orientation(img, self.exif) img = img.convert("RGBA") # Ensure the image is in RGBA mode self.width = img.width self.height = img.height @@ -30,11 +30,11 @@ class ImageTexture: @staticmethod def get_exif(img): - return { ExifTags.TAGS[k]: v for k, v in img.getexif().items() if k in ExifTags } + return { ExifTags.TAGS[k]: v for k, v in img.getexif().items() if k in ExifTags.TAGS } @staticmethod def handle_orientation(img, exif): - orientation = exif.get("Orientation", 1) + orientation = exif.get("Orientation", 1) if exif is not None else 1 if orientation == 3: return img.rotate(180, expand=True) if orientation == 6: return img.rotate(270, expand=True) -- cgit v1.2.3