mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
Add JPEG comment to info dictionary
This commit is contained in:
parent
e9a6149839
commit
e41cfade29
|
@ -60,6 +60,8 @@ class TestFileJpeg:
|
||||||
)
|
)
|
||||||
assert len(im.applist) == 2
|
assert len(im.applist) == 2
|
||||||
|
|
||||||
|
assert im.info["comment"] == b"File written by Adobe Photoshop\xa8 4.0\x00"
|
||||||
|
|
||||||
def test_cmyk(self):
|
def test_cmyk(self):
|
||||||
# Test CMYK handling. Thanks to Tim and Charlie for test data,
|
# Test CMYK handling. Thanks to Tim and Charlie for test data,
|
||||||
# Michael for getting me to look one more time.
|
# Michael for getting me to look one more time.
|
||||||
|
|
|
@ -298,6 +298,11 @@ The :py:meth:`~PIL.Image.Image.open` method may set the following
|
||||||
**exif**
|
**exif**
|
||||||
Raw EXIF data from the image.
|
Raw EXIF data from the image.
|
||||||
|
|
||||||
|
**comment**
|
||||||
|
A comment about the image.
|
||||||
|
|
||||||
|
.. versionadded:: 7.1.0
|
||||||
|
|
||||||
|
|
||||||
The :py:meth:`~PIL.Image.Image.save` method supports the following options:
|
The :py:meth:`~PIL.Image.Image.save` method supports the following options:
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,15 @@ been resolved.
|
||||||
im = Image.open("hopper.jpg")
|
im = Image.open("hopper.jpg")
|
||||||
im.save("out.jpg", quality=0)
|
im.save("out.jpg", quality=0)
|
||||||
|
|
||||||
|
API Additions
|
||||||
|
=============
|
||||||
|
|
||||||
|
Reading JPEG comments
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
When opening a JPEG image, the comment may now be read into
|
||||||
|
:py:attr:`~PIL.Image.Image.info`.
|
||||||
|
|
||||||
Other Changes
|
Other Changes
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,7 @@ def COM(self, marker):
|
||||||
n = i16(self.fp.read(2)) - 2
|
n = i16(self.fp.read(2)) - 2
|
||||||
s = ImageFile._safe_read(self.fp, n)
|
s = ImageFile._safe_read(self.fp, n)
|
||||||
|
|
||||||
|
self.info["comment"] = s
|
||||||
self.app["COM"] = s # compatibility
|
self.app["COM"] = s # compatibility
|
||||||
self.applist.append(("COM", s))
|
self.applist.append(("COM", s))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user