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

PIL.UnidentifiedImageError on HEIF file despite pyheif-pillow-opener #6

Open
mara004 opened this issue Oct 8, 2021 · 2 comments
Open

Comments

@mara004
Copy link

mara004 commented Oct 8, 2021

I tried to use pyheif_pillow_opener, but can't get it to work.

>>> from PIL import Image
>>> from pyheif_pillow_opener import register_heif_opener
>>> register_heif_opener()
>>> img = Image.open(".../heif.heic")
...
PIL.UnidentifiedImageError: cannot identify image file

The test file is available here.
I'm using a Ubuntu 20.04 derivative, pyheif 0.5.1, libheif1 1.11.0, and libde265-0 1.0.8.

(Initially posted at python-pillow/Pillow#2806 (comment))

@homm
Copy link
Contributor

homm commented Oct 17, 2021

I have no problems with this image with pyheif 0.5.1, libheif1 1.11.0 and recent versions. Try following to find actual reason:

import pyheif
pyheif.read('./heif_image.heic')

@mara004
Copy link
Author

mara004 commented Oct 18, 2021

Pyheif says:

>>> pyheif.read(".../heif.heic")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mara/.local/lib/python3.8/site-packages/pyheif/reader.py", line 37, in read
    result = _read_heif_bytes(d, apply_transformations, convert_hdr_to_8bit)
  File "/home/mara/.local/lib/python3.8/site-packages/pyheif/reader.py", line 72, in _read_heif_bytes
    result = _read_heif_context(ctx, d, apply_transformations, convert_hdr_to_8bit)
  File "/home/mara/.local/lib/python3.8/site-packages/pyheif/reader.py", line 100, in _read_heif_context
    result = _read_heif_handle(handle, apply_transformations, convert_hdr_to_8bit)
  File "/home/mara/.local/lib/python3.8/site-packages/pyheif/reader.py", line 135, in _read_heif_handle
    raise _error.HeifError(
pyheif.error.HeifError: Code: 4, Subcode: 3003, Message: "Unsupported feature: Unsupported color conversion"

So apparently the issue is related to bit depth?
pillow-heif and cykooz.heif are both able to handle the image, though.

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

2 participants