mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
d822d85af6
commit
e9f4858491
|
@ -93,11 +93,11 @@ class TestFileJpeg:
|
||||||
with BytesIO() as buf:
|
with BytesIO() as buf:
|
||||||
im.save(buf, format="JPEG")
|
im.save(buf, format="JPEG")
|
||||||
with Image.open(buf) as im2:
|
with Image.open(buf) as im2:
|
||||||
assert im.app['COM'] == im2.app['COM']
|
assert im.app["COM"] == im2.app["COM"]
|
||||||
with BytesIO() as buf:
|
with BytesIO() as buf:
|
||||||
im.save(buf, format="JPEG", comment=dummy_text)
|
im.save(buf, format="JPEG", comment=dummy_text)
|
||||||
with Image.open(buf) as im2:
|
with Image.open(buf) as im2:
|
||||||
assert im2.app['COM'].decode() == dummy_text
|
assert im2.app["COM"].decode() == dummy_text
|
||||||
|
|
||||||
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,
|
||||||
|
|
|
@ -44,8 +44,8 @@ import warnings
|
||||||
from . import Image, ImageFile, TiffImagePlugin
|
from . import Image, ImageFile, TiffImagePlugin
|
||||||
from ._binary import i16be as i16
|
from ._binary import i16be as i16
|
||||||
from ._binary import i32be as i32
|
from ._binary import i32be as i32
|
||||||
from ._binary import o16be as o16
|
|
||||||
from ._binary import o8
|
from ._binary import o8
|
||||||
|
from ._binary import o16be as o16
|
||||||
from ._deprecate import deprecate
|
from ._deprecate import deprecate
|
||||||
from .JpegPresets import presets
|
from .JpegPresets import presets
|
||||||
|
|
||||||
|
@ -716,12 +716,12 @@ def _save(im, fp, filename):
|
||||||
|
|
||||||
comment = info.get("comment")
|
comment = info.get("comment")
|
||||||
if comment is None and isinstance(im, JpegImageFile):
|
if comment is None and isinstance(im, JpegImageFile):
|
||||||
comment = im.app.get('COM')
|
comment = im.app.get("COM")
|
||||||
if comment:
|
if comment:
|
||||||
if isinstance(comment, str):
|
if isinstance(comment, str):
|
||||||
comment = comment.encode()
|
comment = comment.encode()
|
||||||
size = o16(2 + len(comment))
|
size = o16(2 + len(comment))
|
||||||
extra += b'\xFF\xFE%s%s' % (size, comment)
|
extra += b"\xFF\xFE%s%s" % (size, comment)
|
||||||
|
|
||||||
icc_profile = info.get("icc_profile")
|
icc_profile = info.get("icc_profile")
|
||||||
if icc_profile:
|
if icc_profile:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user