Merge pull request #3498 from Glandos/patch-1

Cache EXIF information
This commit is contained in:
Hugo 2019-03-27 17:53:54 +02:00 committed by GitHub
commit 22d7b0495a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -455,6 +455,12 @@ def _getexif(self):
# and is likely to be replaced with something better in a future
# version.
# Use the cached version if possible
try:
return self.info["parsed_exif"]
except KeyError:
pass
# The EXIF record consists of a TIFF file embedded in a JPEG
# application marker (!).
try:
@ -493,6 +499,8 @@ def _getexif(self):
info.load(fp)
exif[0x8825] = _fixup_dict(info)
# Cache the result for future use
self.info["parsed_exif"] = exif
return exif