diff --git a/Tests/images/app13.jpg b/Tests/images/app13.jpg new file mode 100644 index 00000000000..b02d71b40be Binary files /dev/null and b/Tests/images/app13.jpg differ diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index 25c3f754abb..134d6e4df82 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -620,6 +620,10 @@ def test_photoshop(self): '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 3caedbd92f2..ccb22c0ffbe 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