mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-09-24 13:07:00 +03:00
Merge ce8d05484b
into d42e537efe
This commit is contained in:
commit
06ce3758e2
BIN
Tests/images/frame_size.mpo
Normal file
BIN
Tests/images/frame_size.mpo
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 117 KiB |
|
@ -104,16 +104,16 @@ def test_exif(test_file: str) -> None:
|
||||||
|
|
||||||
|
|
||||||
def test_frame_size() -> None:
|
def test_frame_size() -> None:
|
||||||
# This image has been hexedited to contain a different size
|
with Image.open("Tests/images/frame_size.mpo") as im:
|
||||||
# in the SOF marker of the second frame
|
assert im.size == (56, 70)
|
||||||
with Image.open("Tests/images/sugarshack_frame_size.mpo") as im:
|
im.load()
|
||||||
assert im.size == (640, 480)
|
|
||||||
|
|
||||||
im.seek(1)
|
im.seek(1)
|
||||||
assert im.size == (680, 480)
|
assert im.size == (349, 434)
|
||||||
|
im.load()
|
||||||
|
|
||||||
im.seek(0)
|
im.seek(0)
|
||||||
assert im.size == (640, 480)
|
assert im.size == (56, 70)
|
||||||
|
|
||||||
|
|
||||||
def test_ignore_frame_size() -> None:
|
def test_ignore_frame_size() -> None:
|
||||||
|
|
|
@ -193,6 +193,8 @@ def SOF(self: JpegImageFile, marker: int) -> None:
|
||||||
n = i16(self.fp.read(2)) - 2
|
n = i16(self.fp.read(2)) - 2
|
||||||
s = ImageFile._safe_read(self.fp, n)
|
s = ImageFile._safe_read(self.fp, n)
|
||||||
self._size = i16(s, 3), i16(s, 1)
|
self._size = i16(s, 3), i16(s, 1)
|
||||||
|
if self._im is not None and self.size != self.im.size:
|
||||||
|
self._im = None
|
||||||
|
|
||||||
self.bits = s[0]
|
self.bits = s[0]
|
||||||
if self.bits != 8:
|
if self.bits != 8:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user