Simple HEIF/HEIC images plugin for Pillow base on pyhief library.
Originally based on the pyheif-pillow-opener code from Christian Bianciotto.
You can install heif-image-plugin from PyPI:
pip install heif-image-plugin
Just import once before opening an image.
from PIL import Image
import HeifImagePlugin
image = Image.open('test.heic')
image.load()
This is not a big library but if you want to contribute is very easy!
- clone the repository
git clone https://github.com/uploadcare/heif-image-plugin.git
- install all requirements
make init
- do your fixes or add new awesome features (with tests)
- run the tests
make test
- commit in new branch and make a pull request
- Bypass some decoding errors when
ImageFile.LOAD_TRUNCATED_IMAGES
is True.
- Depends on latest pyheif.
! This version requires pyheif with pyheif.open
API. As of 2021.11.25 this API
isn't released and is in pyheif's master. See install-pyheif-master-pillow-latest
target in the Makefile
to install it.
- Fixed potential vulnerability with arbitrary data in exif metadata.
! This version requires pyheif with pyheif.open
API. As of 2021.11.25 this API
isn't released and is in pyheif's master. See install-pyheif-master-pillow-latest
target in the Makefile
to install it.
pyheif.open
API is used for lazy images loading.- Fixed an error when the plugin tries to load any ISOBMFF files.
- AVIF files should work before, but now this is official.
- Patched versions of
pyheif
andlibheif
with exposed transformations is supported. In this case opened image isn't transformed on loading and orientation is stored in EXIFOrientation
tag like for all other image formats. This is faster and consumes less memory.
- No need to register, works after import.
- Fill
info['icc_profile']
on loading. - Close and release file pointer after loading.
- Deconding without custom HeifDecoder(ImageFile.PyDecoder).