Fix KeyError when no Orientation available
This commit is contained in:
parent
76fdd7ccdf
commit
27bbf2ea93
1 changed files with 1 additions and 1 deletions
|
@ -28,7 +28,7 @@ class Heic2Jpeg:
|
||||||
# pyheif.read_heif() rotates the picture
|
# pyheif.read_heif() rotates the picture
|
||||||
# we need to remove the Orientation from EXIF
|
# we need to remove the Orientation from EXIF
|
||||||
exif_dict = piexif.load(metadata['data'])
|
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
|
exif_dict["0th"][piexif.ImageIFD.Orientation] = 1
|
||||||
|
|
||||||
return piexif.dump(exif_dict)
|
return piexif.dump(exif_dict)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue