From 27bbf2ea9315624db085e58b629ca6ca7ea2bd95 Mon Sep 17 00:00:00 2001 From: Jeena Date: Sat, 22 Oct 2022 13:11:05 +0900 Subject: [PATCH] Fix KeyError when no Orientation available --- heic2jpeg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heic2jpeg.py b/heic2jpeg.py index 5ae8ac1..08e8379 100755 --- a/heic2jpeg.py +++ b/heic2jpeg.py @@ -28,7 +28,7 @@ class Heic2Jpeg: # pyheif.read_heif() rotates the picture # we need to remove the Orientation from EXIF exif_dict = piexif.load(metadata['data']) - if exif_dict["0th"] and exif_dict["0th"][piexif.ImageIFD.Orientation]: + if exif_dict["0th"] and exif_dict["0th"].get(piexif.ImageIFD.Orientation): exif_dict["0th"][piexif.ImageIFD.Orientation] = 1 return piexif.dump(exif_dict)