mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
Read EXIF data from subsequent MPO images
This commit is contained in:
parent
0306b80ef7
commit
e00628af3b
|
@ -18,7 +18,8 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
from . import Image, JpegImagePlugin
|
||||
from . import Image, ImageFile, JpegImagePlugin
|
||||
from ._binary import i16be as i16
|
||||
|
||||
# __version__ is deprecated and will be removed in a future version. Use
|
||||
# PIL.__version__ instead.
|
||||
|
@ -78,6 +79,16 @@ class MpoImageFile(JpegImagePlugin.JpegImageFile):
|
|||
return
|
||||
self.fp = self.__fp
|
||||
self.offset = self.__mpoffsets[frame]
|
||||
|
||||
self.fp.seek(self.offset + 2) # skip SOI marker
|
||||
if "parsed_exif" in self.info:
|
||||
del self.info["parsed_exif"]
|
||||
if i16(self.fp.read(2)) == 0xFFE1: # APP1
|
||||
n = i16(self.fp.read(2))-2
|
||||
self.info["exif"] = ImageFile._safe_read(self.fp, n)
|
||||
elif "exif" in self.info:
|
||||
del self.info["exif"]
|
||||
|
||||
self.tile = [
|
||||
("jpeg", (0, 0) + self.size, self.offset, (self.mode, ""))
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user