[Image-SIG] Bug in PNG decoder

Bernhard Herzog herzog@online.de
24 Oct 1999 21:51:22 +0200

"Andrew M. Kuchling" <akuchlin@mems-exchange.org> writes:

> Bernhard Herzog writes:
> >Traceback (innermost last):
> >  File "<stdin>", line 1, in ?
> >  File "/usr/local/lib/python1.5/site-packages/PIL/ImageFile.py", line 161, in load
> >    raise IOError, "decoder error %d when reading image file" % e
> >IOError: decoder error -3 when reading image file
> This looks suspiciously like something I ran into, but never solved.
> A problem with zlib seems likely, because when I dropped back from
> zlib1.1.3 to 1.1.1 it went away, but it never got boiled down to a
> simple test case, nor did I ever determine if it was a problem with
> zlib or a bug in PIL's use of zlib.  (I was leaning toward zlib, but
> never proved that.)  If you can reproduce the problem, try compiling
> PIL with an older version of zlib and see if the error still appears.

I've looked a bit into this by generating PNGs with Gimp and loading
them with PIL. The only conclusion so far is that PIL definitely doesn't
like interlaced PNGs. The particular file I mentioned in my first post
is interlaced, so that probably explains the problems.

PIL raised the same exception with some other non-interlaced PNGs as
well. There may indeed be a zlib related problem because changing the
compression level can solve it.

Bernhard Herzog	  | Sketch, a drawing program for Unix
herzog@online.de  | http://www.online.de/home/sketch/