mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Only read different sizes for "Large Thumbnail" frames
This commit is contained in:
parent
41462d8c55
commit
6175389186
BIN
Tests/images/ignore_frame_size.mpo
Normal file
BIN
Tests/images/ignore_frame_size.mpo
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
|
@ -89,6 +89,17 @@ def test_frame_size():
|
|||
assert im.size == (680, 480)
|
||||
|
||||
|
||||
def test_ignore_frame_size():
|
||||
# Ignore the different size of the second frame
|
||||
# since this is not a "Large Thumbnail" image
|
||||
with Image.open("Tests/images/ignore_frame_size.mpo") as im:
|
||||
assert im.size == (64, 64)
|
||||
|
||||
im.seek(1)
|
||||
assert im.mpinfo[0xB002][1]['Attribute']['MPType'] == "Multi-Frame Image: (Disparity)"
|
||||
assert im.size == (64, 64)
|
||||
|
||||
|
||||
def test_parallax():
|
||||
# Nintendo
|
||||
with Image.open("Tests/images/sugarshack.mpo") as im:
|
||||
|
@ -132,7 +143,7 @@ def test_mp_attribute():
|
|||
with Image.open(test_file) as im:
|
||||
mpinfo = im._getmp()
|
||||
frameNumber = 0
|
||||
for mpentry in mpinfo[45058]:
|
||||
for mpentry in mpinfo[0xB002]:
|
||||
mpattr = mpentry["Attribute"]
|
||||
if frameNumber:
|
||||
assert not mpattr["RepresentativeImageFlag"]
|
||||
|
|
|
@ -82,6 +82,8 @@ class MpoImageFile(JpegImagePlugin.JpegImageFile):
|
|||
n = i16(self.fp.read(2)) - 2
|
||||
self.info["exif"] = ImageFile._safe_read(self.fp, n)
|
||||
|
||||
mptype = self.mpinfo[0xB002][frame]["Attribute"]["MPType"]
|
||||
if mptype.startswith("Large Thumbnail"):
|
||||
exif = self.getexif()
|
||||
if 40962 in exif and 40963 in exif:
|
||||
self._size = (exif[40962], exif[40963])
|
||||
|
|
Loading…
Reference in New Issue
Block a user