From f29fe99d22f014fcb08d800e0c42972bab0fa967 Mon Sep 17 00:00:00 2001 From: Roland Netzsch Date: Thu, 5 Oct 2017 09:54:18 +0200 Subject: [PATCH] Fix #2782 --- PIL/PngImagePlugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PIL/PngImagePlugin.py b/PIL/PngImagePlugin.py index 409d7f302..638e8a919 100644 --- a/PIL/PngImagePlugin.py +++ b/PIL/PngImagePlugin.py @@ -728,7 +728,9 @@ def _save(im, fp, filename, chunk=putchunk, check=0): name = b"ICC Profile" data = name + b"\0\0" + zlib.compress(icc) chunk(fp, b"iCCP", data) - else: + + # You must either have sRGB or iCCP. + # Disallow sRGB chunks when a iCCP-chunk has been emitted. chunks.remove(b"sRGB") info = im.encoderinfo.get("pnginfo")