1. Fredrik Lundh
  2. pil-2009-raclette
Issue #14 new

ValueError when opening PNG file

Anonymous created an issue

I hope this is the official PIL development repository... PIL homepage is light on details. Anyway...

On some palette-based PNG files, an error is raised, e.g.

ValueError: invalid literal for int() with base 10: '\xff'

This is caused by the following line in getcolor() in ImagePalette.py:

self.palette = map(int, self.palette)

which should be

self.palette = map(ord, self.palette)

After coming up with the potential fix, I looked around and found it implemented in some PIL forks out there (and even mentioned in the official mailing list as a fix for this bug) - but unfortunately it's not yet fixed in the official PIL.

Comments (0)

  1. Log in to comment