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

Support new color modes in libheif 1.6.2 #14

Open
damonlynch opened this issue Feb 21, 2020 · 11 comments
Open

Support new color modes in libheif 1.6.2 #14

damonlynch opened this issue Feb 21, 2020 · 11 comments

Comments

@damonlynch
Copy link

damonlynch commented Feb 21, 2020

When opening a Canon HEIF file supported by libheif 1.6.2:

  i = pyheif.read_heif(image_path)
  File "/home/damon/.local/lib/python3.6/site-packages/pyheif/reader.py", line 29, in read_heif
    result = _read_heif_bytes(d, apply_transformations)
  File "/home/damon/.local/lib/python3.6/site-packages/pyheif/reader.py", line 36, in _read_heif_bytes
    result = _read_heif_context(ctx, d, apply_transformations)
  File "/home/damon/.local/lib/python3.6/site-packages/pyheif/reader.py", line 56, in _read_heif_context
    result = _read_heif_handle(handle, apply_transformations)
  File "/home/damon/.local/lib/python3.6/site-packages/pyheif/reader.py", line 78, in _read_heif_handle
    raise HeifError(code=error.code, subcode=error.subcode, message=ffi.string(error.message).decode())
pyheif.error.HeifError: Code: 4, Subcode: 3003, Message: "Unsupported feature: Unsupported color conversion"

Let me know if you need a sample HEIF file from a Canon 1D X Mark III. (I don't own the camera, but someone who does created some for me.) They are 10 bit images.

@ghost
Copy link

ghost commented Feb 22, 2020

Thanks, if you provide a sample I'll check it out.

@damonlynch
Copy link
Author

Hi David,

if you could please email me using the address at https://damonlynch.net/ I'll send you a dropbox link to some samples (which I'd like to keep private, thanks).

Sorry for the delayed reply — computer hardware problems today.

Thanks,
Damon

@damonlynch
Copy link
Author

Attached is a sample script.

heif.zip

@ghost
Copy link

ghost commented Feb 25, 2020

This is complicated. libheif does seem to decode 10-bit (non-rotated) HIF files from the Canon 1D X Mark III, but I haven't found a way to load the resulting data into a viewer to determine if they've been decoded correctly. Pillow, which I normally use to validate decoding, only supports 8-bit images.

It might be best to wait for libheif to support transforms in 10-bit files, and then see what they do for JPEG thumbnail previews - e.g. how do they convert to 8-bit?

@damonlynch
Copy link
Author

My sample script had a bug (cannot display a pixbuf when it's data is not in memory). Attached is a working version.

Yes it might be best to wait to see what the libheif folks do. I suspect in future pillow, Gtk and Qt will provide native 10 bit image support.
heif.zip

@ghost
Copy link

ghost commented Jul 10, 2020

I've added support for the convert_hdr_to_8bit decoding option added to libheif 1.7 and enabled it by default, should just work now. I'll cut a new release soon.

@damonlynch
Copy link
Author

Thanks David!

@ghost
Copy link

ghost commented Jul 11, 2020

Also if you can manage a sample image that I can put into the tests that would be great. I want something I can check-in and run regressions on - can't find anything on the web for some reason.

@damonlynch
Copy link
Author

I can share a vertical and a horizontal image the owner of a Canon 1DX Mark III shared with me. They're large files. What is the best way to share it with you?

@ghost
Copy link

ghost commented Jul 11, 2020

Can you make a pull request? If so pls put them into tests/images/. Thanks!

@damonlynch
Copy link
Author

I'd prefer another method. Figuring out how to do that is not something I can do right now, sorry. (I have an extremely serious academic deadline to deal with.) If you can suggest an alternative method I'd be grateful.

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

1 participant