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

Seek to IFD offset #3584

Merged
merged 2 commits into from Feb 12, 2019
Merged

Seek to IFD offset #3584

merged 2 commits into from Feb 12, 2019

Conversation

radarhere
Copy link
Member

Resolves #3337

The IFD offset is described in the table on page 16 (page 10 according to the bottom of the page numbering) of https://www.exif.org/Exif2-2.PDF. This is parsed at

self.next, = self._unpack("L", ifh[4:])

In TiffImageFile, this is used in _open to seek to the correct position before load(), through

self.tag_v2 = ImageFileDirectory_v2(ifh)
# legacy tag/ifd entries will be filled in later
self.tag = self.ifd = None
# setup frame pointers
self.__first = self.__next = self.tag_v2.next
and
self.fp.seek(self.__next)
.

However, this is not done in _getmp() and _getexif(). This PR fixes that.

@radarhere

This comment has been minimized.

@hugovk

This comment has been minimized.

@hugovk

This comment has been minimized.

@radarhere

This comment has been minimized.

@@ -463,6 +463,7 @@ def _getexif(self):
head = file.read(8)
# process dictionary
info = TiffImagePlugin.ImageFileDirectory_v1(head)
file.seek(info.next)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but whilst this method is being edited, shall we rename the file variable so it's not shadowing the builtin?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I've pushed a commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception while reading EXIF data from JPEG
2 participants