From 4351c37fc4baadbc5d81cf732db608438aa8eebb Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 15 Apr 2021 21:49:51 +1000 Subject: [PATCH] Corrected adobe_transform value --- Tests/test_file_jpeg.py | 7 +++++++ src/PIL/JpegImagePlugin.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index 18837156a..8c3bc76c6 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -795,6 +795,13 @@ 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 + def test_icc_after_SOF(self): with Image.open("Tests/images/icc-after-SOF.jpg") as im: assert im.info["icc_profile"] == b"profile" diff --git a/src/PIL/JpegImagePlugin.py b/src/PIL/JpegImagePlugin.py index e31c61ee8..f449a2dc0 100644 --- a/src/PIL/JpegImagePlugin.py +++ b/src/PIL/JpegImagePlugin.py @@ -140,7 +140,7 @@ def APP(self, marker): self.info["adobe"] = i16(s, 5) # extract Adobe custom properties try: - adobe_transform = s[1] + adobe_transform = s[11] except IndexError: pass else: