mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-24 08:14:10 +03:00
save icc profile from encoderinfo
This commit is contained in:
parent
547794157c
commit
989e162ff6
|
@ -756,8 +756,8 @@ def _save(im, fp, filename, chunk=putchunk, check=0):
|
||||||
for cid, data in info.chunks:
|
for cid, data in info.chunks:
|
||||||
chunk(fp, cid, data)
|
chunk(fp, cid, data)
|
||||||
|
|
||||||
# ICC profile writing support -- 2008-06-06 Florian Hoech
|
icc = im.encoderinfo.get("icc_profile", im.info.get("icc_profile"))
|
||||||
if im.info.get("icc_profile"):
|
if icc:
|
||||||
# ICC profile
|
# ICC profile
|
||||||
# according to PNG spec, the iCCP chunk contains:
|
# according to PNG spec, the iCCP chunk contains:
|
||||||
# Profile name 1-79 bytes (character string)
|
# Profile name 1-79 bytes (character string)
|
||||||
|
@ -765,7 +765,7 @@ def _save(im, fp, filename, chunk=putchunk, check=0):
|
||||||
# Compression method 1 byte (0)
|
# Compression method 1 byte (0)
|
||||||
# Compressed profile n bytes (zlib with deflate compression)
|
# Compressed profile n bytes (zlib with deflate compression)
|
||||||
name = b"ICC Profile"
|
name = b"ICC Profile"
|
||||||
data = name + b"\0\0" + zlib.compress(im.info["icc_profile"])
|
data = name + b"\0\0" + zlib.compress(icc)
|
||||||
chunk(fp, b"iCCP", data)
|
chunk(fp, b"iCCP", data)
|
||||||
|
|
||||||
ImageFile._save(im, _idat(fp, chunk),
|
ImageFile._save(im, _idat(fp, chunk),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user