Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves #44 (Pillow 9.3.0 WEBP EXIF changes) #46

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pillow_heif/misc.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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