-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Failure to identify PNG image #8669
Comments
If I run
So there is a problem with your image. If you would like to ignore the problem, you can do so with from PIL import Image, ImageFile
from io import BytesIO
ImageFile.LOAD_TRUNCATED_IMAGES = True
with open('example.png', 'rb') as image_file:
Image.open(image_file) |
Thanks, @radarhere . The site I'm working on here allows general uploads by the public-- is there any security implication to allowing LOAD_TRUNCATED_IMAGES or is this only a check on internal consistency? Are there any other concerns I should be aware of? |
|
Got it. Thanks, @radarhere . Just to make sure, this is still a valid issue in your view, right? Any error with actually processing the image should happen upon loading, but identification shouldn't fail here? |
That idea has been suggested before in #1687 My conclusion was
|
@radarhere In that case, should this issue be closed or is there anything to be done here? |
I don't think there is anything further, no. We've even documented this scenario to try and help further - https://pillow.readthedocs.io/en/stable/PIL.html#PIL.UnidentifiedImageError |
What did you do?
Attempted to read a PNG image file usable by most applications
What did you expect to happen?
Pillow reads and processed the PNG.
What actually happened?
PIL.UnidentifiedImageError: cannot identify image file <_io.BufferedReader name='example.png'>
What are your OS, Python and Pillow versions?
File here:
The text was updated successfully, but these errors were encountered: