mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
Corrected offset for MPO frames.
This commit is contained in:
parent
d5909e4946
commit
1d3fe7ff45
|
@ -115,7 +115,8 @@ def APP(self, marker):
|
|||
elif marker == 0xFFE2 and s[:4] == b"MPF\0":
|
||||
# extract MPO information
|
||||
self.info["mp"] = s[4:]
|
||||
self.info["mpoffset"] = self.fp.tell()
|
||||
# offset is current location minus buffer size plus constant header size
|
||||
self.info["mpoffset"] = self.fp.tell() - n + 4
|
||||
|
||||
|
||||
def COM(self, marker):
|
||||
|
|
|
@ -42,6 +42,7 @@ class MpoImageFile(JpegImagePlugin.JpegImageFile):
|
|||
self.__framecount = self.mpinfo[0xB001]
|
||||
self.__mpoffsets = [mpent['DataOffset'] + self.info['mpoffset'] \
|
||||
for mpent in self.mpinfo[0xB002]]
|
||||
self.__mpoffsets[0] = 0
|
||||
assert self.__framecount == len(self.__mpoffsets)
|
||||
del self.info['mpoffset'] # no longer needed
|
||||
self.__fp = self.fp # FIXME: hack
|
||||
|
@ -56,10 +57,6 @@ class MpoImageFile(JpegImagePlugin.JpegImageFile):
|
|||
self.fp = self.__fp
|
||||
self.fp.seek(self.__mpoffsets[frame])
|
||||
self.offset = self.__mpoffsets[frame]
|
||||
rawmode = self.mode
|
||||
if self.mode == "CMYK":
|
||||
rawmode = "CMYK;I" # assume adobe conventions
|
||||
self.tile = [("jpeg", (0, 0) + self.size, 0, (rawmode, ""))]
|
||||
self.__frame = frame
|
||||
|
||||
def tell(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user