Skip to content

Commit

Permalink
Resolves #44
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 committed Oct 31, 2022
1 parent 0430fcb commit 516bccc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pillow_heif/misc.py
Expand Up @@ -34,7 +34,9 @@ def set_orientation(info: dict, orientation: int = 1) -> Union[int, None]:

original_orientation = None
if info.get("exif", None):
tif_tag = info["exif"][6:]
tif_tag = info["exif"]
if tif_tag.startswith(b"Exif\x00\x00"):
tif_tag = tif_tag[6:]
endian_mark = "<" if tif_tag[0:2] == b"\x49\x49" else ">"
pointer = unpack(endian_mark + "L", tif_tag[4:8])[0]
tag_count = unpack(endian_mark + "H", tif_tag[pointer : pointer + 2])[0]
Expand Down
2 changes: 1 addition & 1 deletion pillow_heif/private.py
Expand Up @@ -159,7 +159,7 @@ def retrieve_exif(metadata: list):
for i, md_block in enumerate(metadata):
if md_block["type"] == "Exif":
_purge.append(i)
if not _result and md_block["data"] and md_block["data"][0:4] == b"Exif":
if not _result and md_block["data"]:
_result = md_block["data"]
for i in reversed(_purge):
del metadata[i]
Expand Down

0 comments on commit 516bccc

Please sign in to comment.