[Image-SIG] PNG ICC profile buglet in PIL 1.1.7?

Charles Cazabon charlesc-pyimagesig at pyropus.ca
Fri Aug 27 18:19:52 CEST 2010


Greetings,

I recently upgraded a machine from PIL 1.1.5 to 1.1.7 and ran into a couple of
buglets.  One was the "'Nonetype' object has no attribute 'bands'" one with a
fix found here:
http://hg.effbot.org/pil-2009-raclette/changeset/fb7ce579f5f9

The other I've not found any references to in the list archives (or
elsewhere):  while saving an image in PNG format PIL threw an exception
"compress() argument 1 must be string or read-only buffer, not None".  I'm
wondering if anyone else has run into this one, and whether this is a
reasonable way to work around it:

--- PngImagePlugin.py.orig  2010-08-27 10:17:11.570280539 -0600
+++ PngImagePlugin.py   2010-08-27 10:17:32.020279474 -0600
@@ -553,7 +553,7 @@
             chunk(fp, cid, data)
              
     # ICC profile writing support -- 2008-06-06 Florian Hoech
-    if im.info.has_key("icc_profile"):
+    if im.info.get("icc_profile", None):
         # ICC profile
         # according to PNG spec, the iCCP chunk contains:
         # Profile name  1-79 bytes
         # (character string)

Thanks,

Charles
-- 
------------------------------------------------------------------
Charles Cazabon                   <charlesc-pyimagesig at pyropus.ca>
Software, consulting, and services available at http://pyropus.ca/
------------------------------------------------------------------


More information about the Image-SIG mailing list