Skip to content
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

OSError: cannot identify image file #4163

Closed
oebilgen opened this issue Oct 23, 2019 · 4 comments
Closed

OSError: cannot identify image file #4163

oebilgen opened this issue Oct 23, 2019 · 4 comments

Comments

@oebilgen
Copy link

oebilgen commented Oct 23, 2019

Hi, I have a PNG that cannot be opened by the latest Pillow (6.2.1). LOAD_TRUNCATED_IMAGES = True was advised in earlier issues but it did not help.

$ which pip
/...project root.../env/bin/pip
$ pip install --upgrade pillow
Requirement already up-to-date: pillow in /...project root.../env/lib/python3.7/site-packages (6.2.1)
$ python
Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image, ImageFile
>>> ImageFile.LOAD_TRUNCATED_IMAGES = True
>>> Image.open('IMG_2342.png')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/...project root.../env/lib/python3.7/site-packages/PIL/Image.py", line 2818, in open
    raise IOError("cannot identify image file %r" % (filename if filename else fp))
OSError: cannot identify image file 'IMG_2342.png'

I am attaching it as a zip to avoid reformatting by Github. IMG_2342.png.zip

The image file can be opened by file, MacOS (Finder and Preview) and Gimp.

$ file IMG_2342.png
IMG_2342.png: ISO Media, HEIF Image HEVC Main or Main Still Picture Profile

image

Github bug report and latest Chrome cannot open it. Slack thinks that it's a movie.

Github:
IMG_2342

Chrome:
image

Slack:
image

OS: MacOS Catalina 10.15 (latest)
Python: 3.7.2

Thank you for looking into it!

@qihua
Copy link

qihua commented Oct 24, 2019

me too,
OSError: cannot identify image file 'upload/images/201910241359171005.tif'
201910241359171005.tif size 6.7G

@radarhere
Copy link
Member

@qihua without more information, we won't be able to diagnose your problem. Please open another issue, to avoid confusion with the original post which most likely has a different cause. Linking to your image would be ideal, although that image is very large, so a smaller image that you think is similar would be better.

@kkopachev
Copy link
Contributor

Based on file command output provided in issue description, the image is not PNG, but in HEIF format.

@hugovk
Copy link
Member

hugovk commented Oct 25, 2019

Unfortunately HEIF is not supported, see #2806.

Thanks anyway for the report.

@hugovk hugovk closed this as completed Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants