[Image-SIG] PIL.Image.load() returns None

Fredrik Lundh fredrik at pythonware.com
Sun Sep 24 10:32:13 CEST 2006

pyimgsig.20.forest at xoxy.net wrote:

> I'm using PIL 1.1.6b1 with Python 2.5 on Windows.
> Can someone tell me why PIL.Image.getdata() and PIL.Image.load() cause
> subsequent PIL.Image.load() calls to return None?

it's a bug in ImageFile.load, most likely.  here's a patch:

Index: PIL/ImageFile.py
--- PIL/ImageFile.py    (revision 2802)
+++ PIL/ImageFile.py    (working copy)
@@ -115,12 +115,12 @@
      def load(self):
          "Load image data based on tile list"

-        Image.Image.load(self)
+        pixel = Image.Image.load(self)

          if self.tile is None:
              raise IOError("cannot load this image")
          if not self.tile:
-            return
+            return pixel

          self.map = None


More information about the Image-SIG mailing list