mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Merge pull request #5408 from radarhere/indexerror
Corrected JPEG APP14 transform value
This commit is contained in:
commit
d3a3b6dddb
BIN
Tests/images/truncated_app14.jpg
Normal file
BIN
Tests/images/truncated_app14.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -795,6 +795,20 @@ class TestFileJpeg:
|
|||
apps_13_lengths = [len(v) for k, v in im.applist if k == "APP13"]
|
||||
assert [65504, 24] == apps_13_lengths
|
||||
|
||||
def test_adobe_transform(self):
|
||||
with Image.open("Tests/images/pil_sample_rgb.jpg") as im:
|
||||
assert im.info["adobe_transform"] == 1
|
||||
|
||||
with Image.open("Tests/images/pil_sample_cmyk.jpg") as im:
|
||||
assert im.info["adobe_transform"] == 2
|
||||
|
||||
# This image has been manually hexedited
|
||||
# so that the APP14 reports its length to be 11,
|
||||
# leaving no room for "adobe_transform"
|
||||
with Image.open("Tests/images/truncated_app14.jpg") as im:
|
||||
assert "adobe" in im.info
|
||||
assert "adobe_transform" not in im.info
|
||||
|
||||
def test_icc_after_SOF(self):
|
||||
with Image.open("Tests/images/icc-after-SOF.jpg") as im:
|
||||
assert im.info["icc_profile"] == b"profile"
|
||||
|
|
|
@ -140,8 +140,8 @@ def APP(self, marker):
|
|||
self.info["adobe"] = i16(s, 5)
|
||||
# extract Adobe custom properties
|
||||
try:
|
||||
adobe_transform = s[1]
|
||||
except Exception:
|
||||
adobe_transform = s[11]
|
||||
except IndexError:
|
||||
pass
|
||||
else:
|
||||
self.info["adobe_transform"] = adobe_transform
|
||||
|
|
Loading…
Reference in New Issue
Block a user