PNG ICC profile buglet in PIL 1.1.7?

Charles Cazabon <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
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                   <[email protected]>
Software, consulting, and services available at http://pyropus.ca/
------------------------------------------------------------------
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.