Skip to content

Commit

Permalink
Add JPEG comment to info dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 28, 2020
1 parent 1c1ad65 commit 84e37f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Tests/test_file_jpeg.py
Expand Up @@ -62,6 +62,8 @@ def test_app(self):
)
assert len(im.applist) == 2

assert im.info["comment"] == b"File written by Adobe Photoshop\xa8 4.0\x00"

def test_cmyk(self):
# Test CMYK handling. Thanks to Tim and Charlie for test data,
# Michael for getting me to look one more time.
Expand Down
1 change: 1 addition & 0 deletions src/PIL/JpegImagePlugin.py
Expand Up @@ -176,6 +176,7 @@ def COM(self, marker):
n = i16(self.fp.read(2)) - 2
s = ImageFile._safe_read(self.fp, n)

self.info["comment"] = s
self.app["COM"] = s # compatibility
self.applist.append(("COM", s))

Expand Down

0 comments on commit 84e37f7

Please sign in to comment.