HEIF files (HEIC extension)
Spectre5 opened this issue · comments
Per this comment, my understanding is that HEIC files should be supported now. However, it does not work for me, see below. I'm running Linux.
exiv2
does support it:
$ exiv2 --version
exiv2 0.27.5
$ exiv2 IMG_4236.HEIC
File name : IMG_4236.HEIC
File size : 2006004 Bytes
MIME type : image/heic
Image size : 4032 x 3024
Thumbnail : None
Camera make : Apple
Camera model : iPhone SE (2nd generation)
Image timestamp : 2020:07:29 12:59:24
File number :
Exposure time : 1/60 s
Aperture : F1.8
Exposure bias : 0 EV
Flash : No, auto
Flash bias :
Focal length : 4.0 mm
Subject distance:
ISO speed : 125
Exposure mode : Auto
Metering mode : Multi-segment
Macro mode :
Image quality :
White balance : Auto
Copyright :
Exif comment :
But when I use pyexiv2 (2.8.0), it does not work correctly:
>>> import sys
>>> sys.version
'3.9.12 (main, Aug 6 2022, 20:04:53) \n[GCC 11.2.0]'
>>> import pyexiv2
>>> pyexiv2.__version__
'2.8.0'
>>> pyexiv2.Image('IMG_4236.HEIC').read_exif()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/scott/.local/lib/python3.9/site-packages/pyexiv2/core.py", line 15, in __init__
self.img = exiv2api.Image(filename.encode(encoding))
RuntimeError: IMG_4236.HEIC: The file contains data of an unknown image type
Maybe related:
https://github.com/Exiv2/exiv2#support-for-bmff-files-cr3-heif-heic-and-avif
I see that you download a specific release and build it using pybind11 to link to Python, so maybe in the distributed version on PyPI the build does not include bmff support. My separate exiv2 does:
$ exiv2 -Vv
...
enable_bmff=1
...
Exiv2 does not enable BMFF by default, because of copyright risk, so I do the same.
https://github.com/LeoHsiao1/pyexiv2/blob/master/docs/Tutorial.md#bmff
So is building/installing pyexiv2 from source with the appropriate changes the only way then?
No, pyexiv2 adds BMFF when compiling Exiv2.
pyexiv2/.github/workflows/build_exiv2.yml
Line 45 in 087c4eb
Users can enable it by calling a function:
https://github.com/LeoHsiao1/pyexiv2/blob/master/docs/Tutorial.md#bmff
A, I see, thanks!