From 2274c2afc7f86cf501d5ff4c07db363537ef16bc Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 5 Apr 2019 20:02:45 +1100 Subject: [PATCH] Fixed reading APP13 marker without Photoshop data --- Tests/images/app13.jpg | Bin 0 -> 563 bytes Tests/test_file_jpeg.py | 4 ++++ src/PIL/JpegImagePlugin.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Tests/images/app13.jpg diff --git a/Tests/images/app13.jpg b/Tests/images/app13.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b02d71b40bee10cd213e4942feaa43dd683015c5 GIT binary patch literal 563 zcmex=jc} z09{b1B+P2mI8g-Tf`dU9KNzbdJuGUPK4};r}fL9%itef(-TyPyRE!eSc%$_Fw-QlwZ`ZUpDFKq~Ln}r~et|e_!@5 N{`7waoA>{30syI3qBZ~k literal 0 HcmV?d00001 diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index 25c3f754a..134d6e4df 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -620,6 +620,10 @@ class TestFileJpeg(PillowTestCase): 'DisplayedUnitsY': 1, }) + # This image does not contain a Photoshop header string + im = Image.open("Tests/images/app13.jpg") + self.assertNotIn("photoshop", im.info) + @unittest.skipUnless(sys.platform.startswith('win32'), "Windows only") class TestFileCloseW32(PillowTestCase): diff --git a/src/PIL/JpegImagePlugin.py b/src/PIL/JpegImagePlugin.py index 3caedbd92..ccb22c0ff 100644 --- a/src/PIL/JpegImagePlugin.py +++ b/src/PIL/JpegImagePlugin.py @@ -136,7 +136,7 @@ def APP(self, marker): offset = offset + size if offset & 1: offset += 1 - self.info["photoshop"] = photoshop + self.info["photoshop"] = photoshop elif marker == 0xFFEE and s[:5] == b"Adobe": self.info["adobe"] = i16(s, 5) # extract Adobe custom properties