mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Cache EXIF information
In case we need to call _getexif from the outside, since it's already called while parsing. cache the result in self.info. This is compatible with other file using _getexif, like WebP.
This commit is contained in:
parent
30879dfb34
commit
5d8b14fc9e
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user