New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thumbnailing a single gif: 'IOError: codec configuration error when reading image file' #2811
Comments
Does it work with other gif files? Please can you share the problematic gif? |
Slightly smaller reproduction: from PIL import Image
im = Image.open("2811.gif")
im.load() # IOError https://github.com/python-pillow/Pillow/blob/master/PIL/ImageFile.py#L236 returns Adding this beforehand allows it to be loaded, but it's a blank, black image: from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True |
It's kind of a funky gif, it's setting a bit depth of 11:
That gets set in GifImagePlugin:
Which is then failing in the GIF decoder:
Looking at the GIF, it does have a setting of |
According to the spec: https://www.w3.org/Graphics/GIF/spec-gif89a.txt (appendix f) it appears that the legal range is 1-12 bits. There doesn't appear to be anything in the decoder that's relying on that bit length to be < 8, so it appears to be a safe change. |
@Lavr18 Can we use that image in the test suite? |
@wiredfool Yes, sure |
What did you do?
I was trying to thumbnail a gif image and save it
What did you expect to happen?
I expeted to get a gif thumbnail in the "/Thumbnails/" directory.
This same code worked for jpg, png, bmp formats.
What actually happened?
This is the log:
The issue doesn't occur though with
ImageFile.LOAD_TRUNCATED_IMAGES = True
, but in this case the thumbnail is completely black with the size of 213x160 instead of 240x160.What versions of Pillow and Python are you using?
I am using Pillow 4.3.0, Python 2.7.13
The text was updated successfully, but these errors were encountered: