Python interface for libheif library
Project Links
Meta
Author: Alexander Piskun
Requires Python: >=3.9
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
Topic
- Software Development
- Software Development :: Libraries
- Multimedia :: Graphics
- Multimedia :: Graphics :: Graphics Conversion
Programming Language
- Python :: 3
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: Implementation :: CPython
- Python :: Implementation :: PyPy
License
- OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Operating System
- MacOS :: MacOS X
- POSIX :: Linux
- Microsoft :: Windows
pi-heif
This is a light version of Pillow-Heif with more permissive license for binary wheels.
It includes only HEIF decoder and does not support save operations.
All codebase are the same, refer to pillow-heif docs.
The only difference is the name of the imported project.
Install
python3 -m pip install -U pip
python3 -m pip install pi-heif
Example of use as a Pillow plugin
from PIL import Image
from pi_heif import register_heif_opener
register_heif_opener()
im = Image.open("images/input.heic") # do whatever need with a Pillow image
im.show()
8/10/12 bit HEIF to 8/16 bit PNG using OpenCV
import numpy as np
import cv2
import pi_heif
heif_file = pi_heif.open_heif("image.heic", convert_hdr_to_8bit=False, bgr_mode=True)
np_array = np.asarray(heif_file)
cv2.imwrite("image.png", np_array)
Get decoded image data as a Numpy array
import numpy as np
import pi_heif
if pi_heif.is_supported("input.heic"):
heif_file = pi_heif.open_heif("input.heic")
np_array = np.asarray(heif_file)
Accessing Depth Images
from PIL import Image
from pillow_heif import register_heif_opener
import numpy as np
register_heif_opener()
im = Image.open("../tests/images/heif_other/pug.heic")
if im.info["depth_images"]:
depth_im = im.info["depth_images"][0] # Access the first depth image (usually there will be only one).
# Depth images are instances of `class HeifDepthImage(BaseImage)`,
# so work with them as you would with any usual image in pillow_heif.
# Depending on what you need the depth image for, you can convert it to a NumPy array or convert it to a Pillow image.
pil_im = depth_im.to_pillow()
np_im = np.asarray(depth_im)
print(pil_im)
print(pil_im.info["metadata"])
Wheels
| Wheels table | macOS Intel |
macOS Silicon |
Windows |
musllinux* | manylinux* |
|---|---|---|---|---|---|
| CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅ |
| CPython 3.11 | ✅ | ✅ | ✅ | ✅ | ✅ |
| CPython 3.12 | ✅ | ✅ | ✅ | ✅ | ✅ |
| CPython 3.13 | ✅ | ✅ | ✅ | ✅ | ✅ |
| CPython 3.14 | ✅ | ✅ | ✅ | ✅ | ✅ |
| CPython 3.14t | ✅ | ✅ | ✅ | ✅ | ✅ |
| PyPy 3.11 v7.3 | ✅ | ✅ | ✅ | N/A | ✅ |
* x86_64, aarch64 wheels.
1.3.0
Feb 27, 2026
1.2.1
Feb 18, 2026
1.2.0
Jan 23, 2026
1.1.1
Sep 30, 2025
1.1.0
Aug 02, 2025
1.0.0
Jun 29, 2025
0.22.0
Mar 15, 2025
0.21.0
Nov 29, 2024
0.20.0
Oct 18, 2024
0.18.0
Jul 27, 2024
0.17.0
Jul 02, 2024
0.16.0
Apr 01, 2024
0.15.0
Feb 03, 2024
0.14.0
Dec 02, 2023
0.13.1
Oct 15, 2023
0.13.0
Aug 09, 2023
0.12.0
Jul 08, 2023
0.11.1
May 10, 2023
0.11.0
Apr 30, 2023
0.10.1
Apr 03, 2023
0.10.0
Feb 24, 2023
0.9.3
Jan 22, 2023
0.9.2
Jan 18, 2023
0.9.1
Jan 02, 2023
0.9.0
Dec 16, 2022
0.8.0
Nov 20, 2022
0.7.2
Oct 31, 2022
0.7.1
Oct 29, 2022
0.7.0
Oct 12, 2022
Wheel compatibility matrix
Files in release
pi_heif-1.3.0-cp310-cp310-macosx_10_15_x86_64.whl (1022.5KiB)
pi_heif-1.3.0-cp310-cp310-macosx_11_0_arm64.whl (920.2KiB)
pi_heif-1.3.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
pi_heif-1.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4MiB)
pi_heif-1.3.0-cp310-cp310-musllinux_1_2_aarch64.whl (2.2MiB)
pi_heif-1.3.0-cp310-cp310-musllinux_1_2_x86_64.whl (2.4MiB)
pi_heif-1.3.0-cp310-cp310-win_amd64.whl (1.9MiB)
pi_heif-1.3.0-cp311-cp311-macosx_10_15_x86_64.whl (1022.5KiB)
pi_heif-1.3.0-cp311-cp311-macosx_11_0_arm64.whl (920.3KiB)
pi_heif-1.3.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
pi_heif-1.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4MiB)
pi_heif-1.3.0-cp311-cp311-musllinux_1_2_aarch64.whl (2.2MiB)
pi_heif-1.3.0-cp311-cp311-musllinux_1_2_x86_64.whl (2.4MiB)
pi_heif-1.3.0-cp311-cp311-win_amd64.whl (1.9MiB)
pi_heif-1.3.0-cp312-cp312-macosx_10_15_x86_64.whl (1022.7KiB)
pi_heif-1.3.0-cp312-cp312-macosx_11_0_arm64.whl (920.2KiB)
pi_heif-1.3.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
pi_heif-1.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4MiB)
pi_heif-1.3.0-cp312-cp312-musllinux_1_2_aarch64.whl (2.2MiB)
pi_heif-1.3.0-cp312-cp312-musllinux_1_2_x86_64.whl (2.4MiB)
pi_heif-1.3.0-cp312-cp312-win_amd64.whl (1.9MiB)
pi_heif-1.3.0-cp313-cp313-macosx_10_15_x86_64.whl (1022.6KiB)
pi_heif-1.3.0-cp313-cp313-macosx_11_0_arm64.whl (920.2KiB)
pi_heif-1.3.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
pi_heif-1.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4MiB)
pi_heif-1.3.0-cp313-cp313-musllinux_1_2_aarch64.whl (2.2MiB)
pi_heif-1.3.0-cp313-cp313-musllinux_1_2_x86_64.whl (2.4MiB)
pi_heif-1.3.0-cp313-cp313-win_amd64.whl (1.9MiB)
pi_heif-1.3.0-cp314-cp314-macosx_10_15_x86_64.whl (1022.7KiB)
pi_heif-1.3.0-cp314-cp314-macosx_11_0_arm64.whl (920.3KiB)
pi_heif-1.3.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
pi_heif-1.3.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4MiB)
pi_heif-1.3.0-cp314-cp314-musllinux_1_2_aarch64.whl (2.2MiB)
pi_heif-1.3.0-cp314-cp314-musllinux_1_2_x86_64.whl (2.4MiB)
pi_heif-1.3.0-cp314-cp314-win_amd64.whl (1.9MiB)
pi_heif-1.3.0-cp314-cp314t-macosx_10_15_x86_64.whl (1023.6KiB)
pi_heif-1.3.0-cp314-cp314t-macosx_11_0_arm64.whl (921.0KiB)
pi_heif-1.3.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
pi_heif-1.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4MiB)
pi_heif-1.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl (2.2MiB)
pi_heif-1.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl (2.4MiB)
pi_heif-1.3.0-cp314-cp314t-win_amd64.whl (1.9MiB)
pi_heif-1.3.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl (1011.0KiB)
pi_heif-1.3.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl (916.8KiB)
pi_heif-1.3.0-pp311-pypy311_pp73-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
pi_heif-1.3.0-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4MiB)
pi_heif-1.3.0-pp311-pypy311_pp73-win_amd64.whl (1.9MiB)
pi_heif-1.3.0.tar.gz (16.3MiB)