mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Updates to MPO handler based on review.
Took out the explicit reference to the MPO Plug-in in Image as it’s now indirectly referenced via the JPEG Plug-in. Removed the direct MPO Plug-in registration as it’s now shared with the JPEG Plug-in. Commented on assertion.
This commit is contained in:
parent
310bf90222
commit
c97d1a5601
|
@ -353,10 +353,6 @@ def preinit():
|
|||
from PIL import JpegImagePlugin
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
from PIL import MpoImagePlugin
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
from PIL import PpmImagePlugin
|
||||
except ImportError:
|
||||
|
|
|
@ -44,6 +44,8 @@ class MpoImageFile(JpegImagePlugin.JpegImageFile):
|
|||
self.__mpoffsets = [mpent['DataOffset'] + self.info['mpoffset'] \
|
||||
for mpent in self.mpinfo[0xB002]]
|
||||
self.__mpoffsets[0] = 0
|
||||
# Note that the following assertion will only be invalid if something
|
||||
# gets broken within JpegImagePlugin.
|
||||
assert self.__framecount == len(self.__mpoffsets)
|
||||
del self.info['mpoffset'] # no longer needed
|
||||
self.__fp = self.fp # FIXME: hack
|
||||
|
@ -74,7 +76,9 @@ class MpoImageFile(JpegImagePlugin.JpegImageFile):
|
|||
# -------------------------------------------------------------------q-
|
||||
# Registry stuff
|
||||
|
||||
Image.register_open("MPO", JpegImagePlugin.jpeg_factory, _accept)
|
||||
# Note that since MPO shares a factory with JPEG, we do not need to do a
|
||||
# separate registration for it here.
|
||||
#Image.register_open("MPO", JpegImagePlugin.jpeg_factory, _accept)
|
||||
Image.register_save("MPO", _save)
|
||||
|
||||
Image.register_extension("MPO", ".mpo")
|
||||
|
|
Loading…
Reference in New Issue
Block a user