You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using ImageFile.Parser() gets an OSError when reading an in-spec WebP image #2795
Load a valid WEBP image by using ImageFile.Parser. I expect the Parser to read the image without raising an exception – instead, it raises an IOError "image was incomplete".
What versions of Pillow and Python are you using?
I can reproduce the issue with Pythons 2.7.13 and 3.6.1, in both cases with Pillow 4.3.0:
$ pip freezeolefile==0.44Pillow==4.3.0
Sample reproduction
I'm using a sample image 1.webp, downloaded from Google’s WebP gallery. A copy is also attached to the issue (compressed, because GitHub doesn't support WebP).
Traceback (most recent call last):
File "pillow_webp.py", line 8, in <module>
p.close()
File "/Users/alexwlchan/.virtualenvs/tempenv-2005296845a12/lib/python3.6/site-packages/PIL/ImageFile.py", line 438, in close
raise IOError("image was incomplete")
OSError: image was incomplete
The following code does not trigger an error, but proves that Pillow is capable of processing the image correctly, as it produces a valid JPEG which matches Google’s test image:
The issue was originally spotted with a WebP image that Pillow itself had created – a source JPEG image was being saved as WebP, then re-fed to Parser(). I can elaborate if it's useful, but that could go wrong if Pillow crashes in the Parser or if Pillow is writing bad WebP images – and I prefer the repro with Google's test image, because I think it rules out the latter.
Ah, so it looks like WebP just doesn’t have any incremental decoding support – if I clone #1122 and test locally, I don’t get this error. So looks like the fix is somewhere in there, albeit stalled.
Activity
alexwlchan commentedon Oct 8, 2017
Ah, so it looks like WebP just doesn’t have any incremental decoding support – if I clone #1122 and test locally, I don’t get this error. So looks like the fix is somewhere in there, albeit stalled.
hugovk commentedon Oct 8, 2017
How about with PR #2761?
alexwlchan commentedon Oct 8, 2017
Yep, I also get no errors with that.
hugovk commentedon Oct 8, 2017
Great, hopefully one or both of those will be in the next quarterly release.
Improve line coverage of transformer.py (#364)
radarhere commentedon Aug 11, 2018
Closing, after the merge of the relevant PR. Please reopen if this is not resolved.